[Bioperl-l] Bio::TreeIO, Bio::Tree::Draw::Cladogram and phyloxml issues..

Alper Yilmaz alperyilmaz at gmail.com
Tue Dec 29 14:36:03 EST 2009


I have a tree in phyloxml format, and am trying to draw a subtree by
using a spefic node as the root. I used Bio::Tree::Draw::Cladogram for
drawing and encountered some problems.

When I use whole tree and draw it, everything is fine; but, when I
pick a particular node and construct the subtree from that node's
ancestor by using "my $subtree = Bio::Tree::Tree->new(-root =>
$new_root, -nodelete => 1);", Bio::Tree::Draw::Cladogram creates a
faulty EPS file, which contains extra lines added in the middle of the
For instance:
72.0820393261372 126 moveto
(OsIBCD006509) show
30 81.25 moveto
 81.25 lineto
48.5410196630686 120 moveto
30 120 lineto

Should read:

72.0820393261372 126 moveto
(OsIBCD006509) show
48.5410196630686 120 moveto
30 120 lineto

Also, I tried to write the subtree into a new phyloxml file first,
then draw it. The code is shown as follows:
my $savefile = "save.phyloxml";
my $treeout = Bio::TreeIO->new(-format =>'phyloxml',
                               -file => ">$savefile");
my $tree2 = Bio::TreeIO->new(-format =>'phyloxml',
                                                 -file => "save.phyloxml");
my $t1 = $tree2->next_tree;
my $image_output = "test.eps";
my $obj1 = Bio::Tree::Draw::Cladogram->new(-tree   => $t1,
                                                                  -top    => 10,
                                                                -bottom => 10,);
$obj1->print(-file => $image_output);

The generated phyloxml file, which is named save.phyloxml, has an
additional new line between "</phylogeny>" and "</phyloxml>" at the
end of the file. And this additional new line lead an error when doing
the parsing(open file and draw eps). I removed the new line, manually,
then Bio::Tree::Draw::Cladogram gave me the eps file successfully.

Anyone knows how to fix these problems:
1- faulty eps file generation
2- additional newline character in phyloxml output

Is it the problem about the way I create the subtree?

The phyloxml file I used can be downloaded from:

Run this code with the phyloxml file to see newline character problem:

Run this code with the phyloxml file to see faulty eps file problem:

Alper Yilmaz
Post-doctoral Researcher
Plant Biotechnology Center
The Ohio State University
1060 Carmack Rd
Columbus, OH 43210

More information about the Bioperl-l mailing list