[Bioperl-l] distance

Bryan White bpcwhite at gmail.com
Tue May 18 09:49:29 UTC 2010


Hello,

I am trying to create a simple program to show me the distance between
taxa on a given tree. However, I am having trouble getting the bioperl
code to work. Here is the code that I am using:
--------
#! /usr/bin/perl
use strict;
use warnings;
use Bio::Tree::Draw::Cladogram;
use Bio::TreeIO;
#use Bio::TreeFunctionsI;

my $node1 = 'homo_sapiens';
my $node2 = 'murinae';
my $input = new Bio::TreeIO('-format' => 'newick',
				'-file' => 'tree_mammalia_newick.txt');

my $tree = $input->next_tree;

my @nodes = $tree->find_node(-fieldname => 'Homo_sapiens','Murinae');

my $distance = $tree->distance(-nodes => \@nodes);

#print $distance;

--------

And here is the error message I receive:

------------- EXCEPTION -------------
MSG: Must provide 2 nodes
STACK Bio::Tree::TreeFunctionsI::distance /usr/local/share/perl/5.10.1/
Bio/Tree/TreeFunctionsI.pm:811
STACK toplevel ./phylo.pl:19
-------------------------------------


It seems that the nodes are not being read into the @nodes variable.
Any help in figuring this out would be appreciated.

Thanks,
Bryan



More information about the Bioperl-l mailing list