[Bioperl-l] TreeIO problem with nexus format

Jason Stajich jason at cgt.duhs.duke.edu
Tue Aug 3 07:37:48 EDT 2004


write_tree is not supported for the nexus format for the 1.4 version of
bioperl.

You can use newick or you can get the latest version of the nexus.pm
module from CVS which now has the ability to call write_tree.

-jason
On Tue, 3 Aug 2004, Csaba Ortutay wrote:

> Hello,
>
> I am working with phylogenetic trees, and I have the following problem.
>
> I want to build a tree from scratch, and according to some posts on the list I
> made this code:
>
> >>>>>>>>>>>>>>>>>>>>>>
> #!/usr/bin/perl -w
> use strict;
>
> use Bio::TreeIO;
>
> my $nodeL = new Bio::Tree::Node();
> my $nodeR = new Bio::Tree::Node();
>
> $nodeL->id("Left");
> $nodeR->id("Right");
> my $node = new Bio::Tree::Node();
> $node->add_Descendent($nodeL);
> $node->add_Descendent($nodeR);
>
> my $tree = new Bio::Tree::Tree(-root => $node);
> my $treeio = new Bio::TreeIO(-format => 'newick', -file => '>try.tre');
> $treeio->write_tree($tree);
>
> exit;
> <<<<<<<<<<<<<<<<<<<<<<
>
>
> This is working nicely, but when I try to save the tree in nexus format, I got
> this message:
>
> ------------- EXCEPTION  -------------
> MSG: Cannot call method write_tree on Bio::TreeIO object must use a subclass
> STACK Bio::TreeIO::nexus::write_tree
> /usr/lib/perl5/site_perl/5.8.0/Bio/TreeIO/nexus.pm:170
> STACK toplevel ./makemaintree.pl:25
> --------------------------------------
>
> I am using bioperl 1.4.
>
> Do you have any idea, what is wrong?
>
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list