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

Alper Yilmaz alperyilmaz at gmail.com
Tue Dec 29 19:36:03 UTC 2009


Hello,

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
file.
For instance:
.
.
.
72.0820393261372 126 moveto
(OsIBCD006509) show
30 81.25 moveto
 81.25 lineto
  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");
$treeout->write_tree($subtree);
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:
http://grassius.org/download/HSF.phyloxml

Run this code with the phyloxml file to see newline character problem:
http://pastebin.com/f87ee1ee

Run this code with the phyloxml file to see faulty eps file problem:
http://pastebin.com/fc4715a1

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



More information about the Bioperl-l mailing list