Life is too short for hideous icons!

I generally love the clean, thoughtful layout that makes Macs different from everything else. They’re great at that … with one major, terrible exception. And by that I mean their default blue, shadowy, 3d-for-no-reason folder icons. They are everywhere, and they destroy all efforts to stylize (or destylize) your desktop view.

GenericFolderIcon

I fixed this a while ago when I bought my current computer, but updating to Mavericks undid all of my efforts. Clearly I had to come up with a reproducible way to fix it.

There are two ways to do this:

The slow dumb way:

  • download or design a folder icon you like. (I used this one – it’s clean and beautifully semitransparent). The icon should have a .icns extension.
  • for every folder in your computer:
    • use the get info option to manually change it.
  • and then repeat every time you make a new folder for as long as you choose to own a mac.

The slightly better, long-term way:

  • download or design your icon
  • replace the default icon images that your computer uses to create new folders.
    • open Terminal and do this:

cd /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources; open .

  • replace every one by hand – there are dozens – and tell your computer that you really do intend this crazy action.

That’s what I did the first time, but repeating something so laborious is goofy. So this time I wrote a simple python program to do it.

The fun python way:

  • go to that same Resources directory and back up all of your icon images in case things go awry.
  • create a temporary working folder (like on your desktop). I’ll call it ~/Desktop/replaceIcons
  • make a quick list of the icons you need to replace. Since Mac labels the important folder icons with the word Folder, this is easy to automate with a single command:

ls *Folder* > ~/Desktop/replaceIcons/fileNames.txt (wordpress converted the > to > – bug).

  • That just dumped a text file into the temporary working directory that lists all of the names you need to replace. Quickly open that to check it and also remove the last empty line, and save it.
  • put your icon in the same folder, and also put this python script into the same folder:
\#!/usr/bin/python
# wordpress inserted a backslash in the first line. don't copy that.
# Name this script 'replaceIcons.py'

import sys
import shutil
import os

def changeNames(fileNameList, fileToCopy):
  f = open(fileNameList, 'rU')
  text = f.read()
  textSplit = text.split('\n')
  path = os.getcwd() + '/'
  pathFileToCopy = path + fileToCopy
  for file in textSplit:
    pathFile = path + file
    print pathFile
    shutil.copy(pathFileToCopy, pathFile)
  f.close()

def main():    
  if len(sys.argv) == 1:
    print 'usage: ListOfNamesFile IconToCopy\n'
    sys.exit(1)

  else: 
    changeNames(sys.argv[1], sys.argv[2])    
    print 'done\n'
    sys.exit(1)

if __name__ == '__main__':
  main() 
  • Then open up your terminal, navigate to your temporary working folder cd replaceIcons
  • make the script do its simple magic:

python replaceIcons.py folderNames.txt myIcon.icns

Now you should have many icons with the same names as the ones you hope to replace. Go back to the Resources folder and drop all of your new icons into the folder. Mac will ask you if you really do want to do that, and click the box that says ‘apply to all’, and click ‘replace’.

Voila! Now just restart your computer and your icons will no longer make your eyes bleed. If you use Dropbox, this will not change your shared folders (which is good for me so that I can clearly identify the folders that others can also see).

I assume that this can all be done with just a few lines of code, and if that’s true I welcome suggestions. Also, several of the manual steps can be done in python as well, but I didn’t really want to mess with permissions in a script like this.

I hope it works for you. Here is my much improved view:

desktopView

finderView

Advertisements

I love it when negative results and outliers win

Recently, we at the University of Oregon were treated to a terrific seminar from Tom Reimchen. His has spent a career looking at the evolutionary traits of tiny stickleback fish in lakes on Haida Gwaii, off the coast of British Columbia. His results were sweeping and impressive, as results often are after decades of work – he has found over and over that a few morphological aspects of stickleback in lakes near each other varied based on their small lake environment and resulting selective pressures. Basically, long spines and tough protective plates protect from attack, but at a fitness (speed and evasion) cost. Murkier lakes held sneak attacks from predators and thus tough protection was key; clear water allows stickleback to see attacks coming, so speed and evasion win the day. A beautiful story.

But studying many different lakes with many different chemistries, conditions and myriad other covariates makes for nuanced conclusions – most skeptical scientists hearing these results immediately want to know if there is anything more simple that might explain. Which is why Reimchen really struck me with an answer to a good question. An audience member was curious about fitness costs of building tough plates, and if these structures appeared even when resources like Ca and P were limiting – these are necessary to build bony plates. Over the years Reimchen and colleagues of course collected many different environmental parameters, including pH and Ca concentration. Almost all of these lakes were strongly Ca-deficient, meaning that it would be really hard to build bony plates, but if the water was murky and if the right predators were present, the stickleback always seemed to be well protected by these chemically-expensive structures. Closer to the ocean, however, splash and surge from salty water makes for high Ca conditions, and the researchers found that these lakes near the ocean were no more likely to hold heavily-plated stickleback than those inland, and that visibility and predation explained most of the variability.

To a researcher trying to find out if predation is driving prey morphology, this negative result (bony structures are not explained by resource availability) likely comes as a relief – it supports your alternative hypothesis. But stoichiometry wants to explain so much in the natural world that it is really cool to see results that defy such a unifying principle.

Maybe Josh Schimel’s book, Writing Science is the reason I latched onto this result. I absolutely love this book and it is changing the way I write in a big way – but also the way I think about science. Schimel goes to great length early in the book to argue for paying close attention to outliers and ugly data points, since outliers are often “…more novel, exciting, and important science.” This chapter hit me hard – I’m a data analyst for the most part and I almost always try to ignore outliers. It comes easy for me to think that samples were mishandled, poorly sequenced, or in other ways discountable. Outliers tend to look ugly, and negative results might mean that my data are not clean enough to see the relationship I assume is there. But Schimel’s book, along with Reimchen’s talk, have helped me to take a step back when data are not explained cleanly – to look even deeper when a few samples are uncooperative. As a graduate student studying statistics, I committed to memory the accepted rules for ignoring outliers in a dataset. The rules generally revolve around an assumption that points represent replicates from the same population; discount them if you have reason to believe they don’t. Now I am rethinking this approach, realizing that instead of discounting, I should more thoroughly investigate why a point is so far away from expectation.

The case for full frontal analysis – thoughts on Claesson et al. 2012

One of the tricky things about complex statistical methods is trying to display and interpret results eloquently. Multivariate analysis on high-throughput microbial community data generally requires several layers of dimensional compression before a clean answer emerges (i.e., relativize community abundances, calculate beta-diversity using one of many different indices, ordinate, cluster, and discriminate between groups, and then compare to a myriad of environmental data that have been similarly dimensionally compressed, etc). Add to this task that each layer of analysis carries with it assumptions that the analyst should consider and confirm. The visualization of such results might end up with points floating in undefined multidimensional space being pushed around by arrow vectors, each with a cryptic environmental variable hanging from the tip – and some floating factor-level centroids if you’re lucky. Immerse all of these points in thousands of OTU weightings, and voila – an unreadable, but groundbreaking result (see figure below – the default constrained ordination graphical output for the very simple dune sample dataset – then scale that up to a HTS dataset!). I assume I am not alone in occasionally giving in to overly-simplified ways of presenting a subset of what I though was a comprehensive set of results, simply because the results/visualizations were too difficult to present (or too complex for reviewers to review!). Being good at extensive analytical techniques entails being good at displaying such results in a way that describes why you chose to go to such lengths.

Screen Shot 2013-03-24 at 7.47.11 PM
Poor form – default constrained ordination output. This is readable for no one ever, though they do end up in publication not too much better than this.

For this reason I am ecstatic when I see complex community analysis performed unabashedly, in a high-profile venue, and done well. Such is the case with a paper that came out last summer in Nature. Our lab has been discussing this paper as ‘analysis porn’ – in a good way. Claesson et al. approached some very complex questions and used very complex methods to answer them well. One reason I really like their flashy approach to analysis: it got me (and many others) to read a paper about elderly people’s stool samples, and to get a lot out of it! Health-related results aside, I wanted to focus purely on the analytical choices made in this paper, and specifically their R mastery and data visualization chops – with some critique thrown in for good measure.

Their figures are complex and densely packed with facets and caveats, the way microbial data really exist. They also execute a few nice visuals that others often fail in attempting. An example: the stacked relative abundance bar plots in Figure 1. These often go so terribly wrong, and yet so many groups love to include them over more important figures. In this case the plots are situated as a complimentary piece of a much larger and more telling figure – they give the results context. The colors they used are also reasonably easy to distinguish (even for color-blind readers) and are phylogenetically coherent (i.e., blueish colors are Bacteroidetes, and reddish are Firmicutes, etc).  The ordination plots in the same figure are shown for both weighted unifrac and unweighted, which is generally omitted but informative when included. The comparison of these helps to understand some aspects of how abundance influences the results. On the downside, I can never understand why anyone would want to project points against a black background. This is default in some software, but since these figures appear to have been produced in R, I assume it was intentional? While this choice might help to distinguish the lighter colors, it is to the detriment of the other colors, and equally hard on toner cartridges and eyes.

Screen Shot 2013-03-24 at 7.04.06 PM
Figure 1 from Claesson et al 2012

The part I like most, though, is the presentation of Figure 2 – both the inclusion of Procrustes analysis, and the nice, adjacent comparisons of food weights to gut samples. By default these might all be put on the same biplot, and would be a mess requiring the stripping of important complexity. Separated, they lend depth and context to the results. Points in (a) are positioned by multivariate diet, with (b) the strongest food drivers for comparison. Then the (black again) PCoA plots show quite well that diet, living situation, and microbiota vary together, and that sample dissimilarity depends heavily on whether abundance is considered.

Screen Shot 2013-03-24 at 7.02.17 PM
Figure 2 from Claesson et al 2012

Figure 4 tops it all off with nicely displayed and nuanced Wiggum plots surrounding more ordinations, this time displayed as dispersion groups, and all layered with health and diet correlates. There is a LOT to digest in this figure, and I like the way that it is displayed for the reader to slowly digest, instead of simply boiling it down to a simplified figure that can easily be explained in the legend. Though it is an attractive figure, it is decorated construction rather than constructed decoration, to paraphrase the architect Pugin. And the thrust of the figure is a really important revelation – that we can perhaps arrive at a definition ‘healthy’ microbiome and an ‘unhealthy’ one, or at least indicators along the spectrum. This figure is complex and necessarily so to explain this important result.

Screen Shot 2013-03-24 at 7.05.20 PM
Figure 4 from Claesson et al 2012

It is curious that the authors spent considerable time refining the visual appeal of most of the graphics, but decided that rectangular, pixelesque data points would suffice for some ordinations and NMR results. Against the backdrop of the rest of the well-manicured figures, it seems distractingly unfinished.

The last think I’ll say about this paper is their extensive use of supplemental methods. A paper like this simply cannot leave details of analysis to be guessed upon. The authors did a nice job of including lots of details and analytical caveats for those patient enough to read. It’s a nice touch and one I certainly look for when reading a paper. This work by Claesson and colleagues certainly gives me something to think about the next time I’m faced with watering down the complexity in a study simply for an easier story to tell.

___________________________

citation:

Claesson MJ, Jeffery IB, Conde S, Power SE, O’Connor EM, Cusack S, Harris HMB, Coakley M, Lakshminarayanan B, O’Sullivan O, Fitzgerald GF, Deane J, O’Connor M, Harnedy N, O’Connor K, O’Mahony D, van Sinderen D, Wallace M, Brennan L, Stanton C, Marchesi JR, Fitzgerald AP, Shanahan F, Hill C, Ross RP, O’Toole PW. 2012. Gut microbiota composition correlates with diet and health in the elderly. Nature 488:178–184. http://dx.doi.org/10.1038/nature11319