This last Saturday Chris and I participated in a code jam organized by a friend using processing, a programming language oriented towards enabling interactive visualization and graphics. I used processing to create all of the graphs in the recent Nature Biotechnology paper – I came to it because I was frustrated with an inability to create exactly the graph type I wanted. In the end each of my graphs is created by a small program, but I’m happy with putting in that effort to get something that looks great.
For the code jam I had been wanting to create a browsable tree of life akin to the fractal-like tree of life comic I made a while back. To this end I created a Newick format tree, working my way back from humans. I filled in only organisms and names that were familiar to me, reasoning that obscure organisms only serve to make a tree confusing, cluttered, and unapproachable. So far I’m only as far as unikonts, you can get a copy of it here if you like. (Please consider this as licensed under CC-by-SA if you’d like to use it.)
Chris found and applied some java code for interpreting a newick format file and creating a tree data structure, and I worked out a simple recursion for drawing the tree out to a given depth from a given node. Clicking on a node redraws the tree from that location; pressing any key zooms back out by one level. Here is a screenshot of the base:
One of the nice aspects of processing is that visualizations should be portable to java applets. Although we haven’t done it yet, hopefully we’ll be able to do that. If you have processing installed, you can download a copy of what we wrote. (You’ll need to fix the file path in the source code to point at the tree.) Other improvements I’d like to do: to make zooming smooth rather than jumping (this can be disorienting when a large change occurs) and add the ability to search and choose an organism, then color the tree according to distance from that organism so you can click “warmer” colors to get closer to it.
The theme of the event was “clocks” and although I had intended to work on this anyway, it did fit into the theme fairly well: we called the program “Evolutionary Time”. We were thrilled to be awarded the “wealth” prize by processing founders Ben Fry and Casey Reas: a gift certificate to the MIT Press Bookstore, which I intend to spend on a reference or two for processing, hopefully to further improve our program. 😉