Bio-Phylo - Re: SVG Problem

Posted on Tue Aug 9 23:35:55 2005 by rvosa in response to 863 (See the whole thread of 5)
Re: SVG Problem
Hi Nicholas,

the package works under the assumption that newick formatted tree files contain multiple trees, one tree per line. It gets confused by the line feeds in your tree description. Do a search and replace on the line feeds and try again. For example, you can while(<>) through the tree, chomp off the line breaks and concatenate them all into $chomped_string, and then parse and unparse like this:
my $parser = new Bio::Phylo::Parsers; my $tree = $parser->parse(-format => 'newick', -string => $chomped_string)->first; my $unparser = new Bio::Phylo::Unparsers; # NOTE: -mode => 'phylo' yields phylograms, so with branch lengths my $svg = $unparser->unparse(-format => 'svg', -mode => 'phylo', -phylo => $tree);
W.r.t. your request for URLs: SVG allows for that, but there's currently no option to include them into graphs produced by Bio::Phylo. Good idea though, will try to implement that.

Hope this helps,

Rutger
Write a response