[Bioperl-l] distance

Jun Yin jun.yin at ucd.ie
Tue May 18 11:07:43 UTC 2010


Hi, Bryan,

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

First, You should specify the fieldname. The "fieldname" itself doesnot seem
like a valid key. The default field name is "id".
Second, the find_node method can only search for one specific term at one
time.
Third, distance method can only work on two nodes.

So try this:

my @nodes_human = $tree->find_node(-id => 'Homo_sapiens'); 
my @nodes_murinae=$tree->find_node(-id=>'Murinae');

my $distance = $tree->distance(-nodes =>
\($nodes_human[0],$nodes_murinae[0])); #Providing you only have one match
for "Homo_sapiens" and " Murinae".

Cheers,
Jun Yin
Ph.D. student in U.C.D.

Bioinformatics Laboratory
Conway Institute
University College Dublin

-----Original Message-----
From: bioperl-l-bounces at lists.open-bio.org
[mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of Bryan White
Sent: Tuesday, May 18, 2010 10:49 AM
To: bioperl-l at bioperl.org
Subject: [Bioperl-l] distance

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
_______________________________________________
Bioperl-l mailing list
Bioperl-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/bioperl-l

__________ Information from ESET Smart Security, version of virus signature
database 5099 (20100509) __________

The message was checked by ESET Smart Security.

http://www.eset.com


 

__________ Information from ESET Smart Security, version of virus signature
database 5099 (20100509) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 





More information about the Bioperl-l mailing list