Question: Convert From Newick To Dot Language
0
gravatar for ajingnk
5.5 years ago by
ajingnk120
United States
ajingnk120 wrote:

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 • 3.2k views
ADD COMMENTlink modified 5.5 years ago by Pierre Lindenbaum119k • written 5.5 years ago by ajingnk120

googled and found: http://jean-paul.davalan.pagesperso-orange.fr/graphs/ph/index-en.html

ADD REPLYlink written 5.5 years ago by Pierre Lindenbaum119k

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.

ADD REPLYlink modified 5.5 years ago • written 5.5 years ago by ajingnk120
2
gravatar for Pierre Lindenbaum
5.5 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum119k wrote:

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

ADD COMMENTlink modified 4.3 years ago • written 5.5 years ago by Pierre Lindenbaum119k

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?

ADD REPLYlink written 5.5 years ago by ajingnk120

yep, I know, but I'm lazy :-) have a look at the 'edge attributes http://www.graphviz.org/doc/info/attrs.html#d:weight and change the 'while' loop in the newick.y file.

ADD REPLYlink written 5.5 years ago by Pierre Lindenbaum119k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 674 users visited in the last hour