Convert From Newick To Dot Language
1
0
Entering edit mode
11.1 years ago
ajingnk ▴ 130

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 • 5.3k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode

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 REPLY
2
Entering edit mode
11.1 years ago

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 COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 2230 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6