Saturday, December 4, 2010

Gene Ontology: showing the graph 1


The graphing program I used is Graphviz, from here. On the laptop I'm using, I have Graphviz.app (2.20), which was installed about 2 years ago, but they are currently up to version 2.26, and 2.27 is in development. The Mac OS X .app version seems to not be upgraded anymore, but my copy still works. You can also get Graphviz from MacPorts.

I can launch the command line version like so (or whatever the path to the MacPorts version is):
/Applications/Graphviz.app/Contents/MacOS/Graphviz ~/Desktop/example1.dot

but I normally double-click (or just drop a file with commands on top of the application icon). A very simple example gives the graphic above:


digraph G {
A -> B;
A -> C;
B -> C;
C -> D;
D[color="cyan",
style=filled]
}

Graphviz does the heavy lifting for us. I like that!

Code for the example from last time:

digraph G {
node[style="filled",
fontsize="22",color="cyan"];
A[label="nuclear\npart"];
B[label="intracellular\norganelle\npart"];
A -> B;
C[label="protein\ncomplex"];
D[label="macromolecular\ncomplex"];
C -> D;
E[label="intracellular\npart"];
F[label="cell\npart"];
E -> F;
G[label="organelle\npart"];
B -> G;
B -> E;
H[label="cellular_component"];
F -> H;
I[label="mediator\ncomplex"];
I -> C;
J[label="nucleoplasm\npart"];
I -> J;
J -> A;
D -> H;
G -> H;
}

No comments: