[Bioperl-l] distance

Bryan White bpcwhite at gmail.com
Tue May 18 21:34:06 UTC 2010


Thanks guys, I got it working!

Bryan

On May 18, 4:07 am, Jun Yin <jun.... at ucd.ie> wrote:
> 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-boun... at lists.open-bio.org
>
> [mailto:bioperl-l-boun... at lists.open-bio.org] On Behalf Of Bryan White
> Sent: Tuesday, May 18, 2010 10:49 AM
> To: bioper... 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
> Bioper... at lists.open-bio.orghttp://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
>
> _______________________________________________
> Bioperl-l mailing list
> Bioper... at lists.open-bio.orghttp://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list