[Bioperl-l] distance

Jun Yin jun.yin at ucd.ie
Tue May 18 11:15:14 UTC 2010


Hi, Bryan,

Use Adam's code. The last sentence of my code was wrong. I made a wrong
reference...

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 Adam "Sj?gren"
Sent: Tuesday, May 18, 2010 11:21 AM
To: bioperl-l at bioperl.org
Subject: Re: [Bioperl-l] distance

On Tue, 18 May 2010 02:49:29 -0700 (PDT), Bryan wrote:

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

I think you may have misunderstood the documentation of find_node(). You
are supposed to give the fieldname after the dash, so what you want is:

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

- if the field you want to match on is 'id'.

Also, I don't think you can get find_node() to do 'OR'-searches , so
you'll need to do something like this:

= = =
  #!/usr/bin/perl

  use strict;
  use warnings;

  use Bio::TreeIO;

  my $input=Bio::TreeIO->new('-format' => 'newick',
                             '-file' => 'tree_mammalia_newick.txt');
  my $tree=$input->next_tree;

  my ($node1)=$tree->find_node(-id=>'Homo_sapiens'); # this (arbitrarily)
picks the first match
  my ($node2)=$tree->find_node(-id=>'Murinae');      # -"-

  my $distance=$tree->distance(-nodes=>[$node1, $node2]);

  print "$distance\n";
= = =

It is much easier to help if you give an example of the input as well as
the script. I constructed this stand-in for your newick file to test on:

  (Homo_sapiens:1.1,B:2.2,(C:3.3,Murinae:4.4):5.5);


  Best regards,

    Adam

-- 
                                                          Adam Sjøgren
                                                    adsj at novozymes.com

_______________________________________________
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