This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert From Newick To Dot Language

I want to plot tree like human kinome. Looks like only GraphViz can do that with Spring-Electrical Model for graph generation. A life of tree are shown here made by GraphViz.

However, my tree is in Newick format. Is there any easy way to convert Newick format to DOT language?

Thanks!

tree

That is not quit right. For example, you can try to paste: "((D:10,C:4)D_C,B:4,A:13)" as input. However, the result doesn't match the input. Probably, it only works for very specific Newick format.

1 answer

OK, I've changed the code of one my my previous answer "newick to json:" http://plindenbaum.blogspot.fr/2012/07/parsing-newick-format-in-c-using-flex.html

Here is the code:

input:

echo "((D:10,C:4)D_C,B:4,A:13);" | ./a.out

output:

digraph G {
id6[label=""];
id3[label="D_C"];
id1[label="D:10"];
id3 ->  id1
id2[label="C:4"];
id3 ->  id2
id6 ->  id3
id4[label="B:4"];
id6 ->  id4
id5[label="A:13"];
id6 ->  id5
}

enter image description here

For D:10, 10 is the weight of edge between D and D_C. Anyway to adapt the weight as proportional length of edge into the dot language?

Log in to answer this question.