Friday, October 19, 2007

Specifying a classification with GraphViz

I made this graph with GraphViz (a freely available software application).



In my prior post, I used this same figure, which displays the entire Neoplasm Classification Schema, in a graphic form.

Here's how to use GraphViz to display a classification or ontology.

The GraphViz download site is:

http://www.graphviz.org/Download.php

Windows users can download graphviz-2.14.1.exe (5,614,329 bytes).

You can install the software by running the .exe file.

GraphViz has its own language, in which you list the relationships among the different classes, and then it builds a graphic view of the classification.

GraphViz has sub-applications:dot, fdp, twopi, neato, and circo. The twopi application, which I used, creates graphs that have a radial layout.



digraph G {
size="10,16";
ranksep="1.75";
node [style=filled color=gray65];
Neoplasm [label="Neoplasm"];
node [style=filled color=lightgray];
EndodermEctoderm
[label="Endoderm\/\nEctoderm"];
NeuralCrest [label="Neural Crest"];
GermCell [label="Germ cell"];
Neoplasm -> EndodermEctoderm;
Neoplasm -> Mesoderm;
Neoplasm -> GermCell;
Neoplasm -> Trophectoderm;
Neoplasm -> Neuroectoderm;
Neoplasm -> NeuralCrest;
node [style=filled color=gray95];
Trophectoderm -> Molar;
Trophectoderm -> Trophoblast;
EndodermEctoderm -> Odontogenic;
EndodermEctodermPrimitive
[label="Endoderm\/Ectoderm\nPrimitive"];
EndodermEctoderm -> EndodermEctodermPrimitive;
Endocrine
[label="Endoderm/Ectoderm\nEndocrine"];
EndodermEctoderm -> Endocrine;
EndodermEctoderm -> Parenchymal;
Odontogenic
[label="Endoderm/Ectoderm\nOdontogenic"];
EndodermEctoderm -> Surface;
MesodermPrimitive
[label="Mesoderm\nPrimitive"];
Mesoderm -> MesodermPrimitive;
Mesoderm -> Subcoelomic;
Mesoderm -> Coelomic;
NeuroectodermPrimitive
[label="Neuroectoderm\nPrimitive"];
NeuroectodermNeuralTube
[label="Central Nervous\nSystem"];
Neuroectoderm -> NeuroectodermPrimitive;
Neuroectoderm -> NeuroectodermNeuralTube;
NeuralCrestMelanocytic
[label="Melanocytic"];
NeuralCrestPrimitive
[label="Neural Crest\nPrimitive"];
NeuralCrestEndocrine
[label="Neural Crest\nEndocrine"];
PeripheralNervousSystem
[label="Peripheral\nNervous System"];
NeuralCrestOdontogenic
[label="Neural Crest\nOdontogenic"];
NeuralCrest -> NeuralCrestPrimitive;
NeuralCrest -> PeripheralNervousSystem;
NeuralCrest -> NeuralCrestEndocrine;
NeuralCrest -> NeuralCrestMelanocytic;
NeuralCrest -> NeuralCrestOdontogenic;
GermCell -> Differentiated;
GermCell -> Primordial;
}



You create your the image neo2.png, from the neo2.dot specification (above) by invoking the twopi subapplication on a command line.

c:\ftp>twopi -Tpng neo2.dot -o neo2.png


-Jules Berman