This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert phylip tree format in text format to png image with perl.
((raccoon:19.19959,bear:6.80041):0.84600,((sea_lion:11.99700, seal:12.00300):7.52973,((monkey:100.85930,cat:47.14069):20.59201, weasel:18.87953):2.09460):3.87382,dog:25.46154);

Suppose this is my tree. I want to convert it to png image.

I tried Bio::Tree::Tree module but it writes wrong nodes in svg file.

code:

use Bio::TreeIO;
use SVG::Graph;

my $in = new Bio::TreeIO(-file => 'DATA',
                         -format => 'newick');

my $out = new Bio::TreeIO(-file => '>mytree.svg',
                            -format => 'svggraph');
while(  $tree = $in->next_tree ) {
    $out->write_tree($tree);
}

system(convert mytree.svg svg2.png);
phylip phylogeny

I tried Bio::Tree::Tree module but it writes wrong nodes in svg file.

Show us the code please.

@pierre I added my code.

1 answer

The old TreeFam API has some code to draw a tree image in PNG format from a NH/NHX representation.

Log in to answer this question.