[Bioperl-l] TreeIO problem with nexus format

Csaba Ortutay Csaba.Ortutay at uta.fi
Tue Aug 3 02:17:13 EDT 2004


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?

-- 
Csaba Ortutay PhD
University of Tampere
Institute of Medical Technology
Bioinformatics Group
Finland
Csaba.Ortutay at uta.fi





More information about the Bioperl-l mailing list