[Bioperl-l] Getting distance matrix from phylogenetic tree
Mark A. Jensen
maj at fortinbras.us
Mon Aug 24 11:30:27 UTC 2009
Hi Joris,
AFAIK, there is only one path between any two nodes in a typical
phylogenetic tree, the one passing through the most recent common
ancestor of the nodes. The distance() method in Bio::Tree::TreeFunctionsI
will give you what I think you want:
use Bio::TreeIO;
use Bio::Tree::TreeFunctionsI;
$t =
Bio::TreeIO->new(-file=>'t/data/urease.tre.nexus', -format=>'nexus')->next_tree;
$n1 = $t->find_node('Anidulans');
$n2 = $t->find_node('Ncrassa');
$dist = $t->distance(-nodes => [$n1, $n2] );
print $dist;
Use the Bio::TreeIO package to read in the tree in your favorite format;
it will handle many.
cheers, MAJ
----- Original Message -----
From: "joris meys" <jorismeys at gmail.com>
To: <bioperl-l at lists.open-bio.org>
Sent: Sunday, August 23, 2009 11:08 AM
Subject: [Bioperl-l] Getting distance matrix from phylogenetic tree
> Hi,
>
> I'm currently exploring the phylogenetic parts of Bio Perl, but I
> can't seem to find a quick solution to following problem :
> Say you have a tree obtained by a certain method. From this tree, you
> want to have the evolutionary distances between species, defined as
> the sum of the branch lengths between any 2 species. There is as far
> as I know no function for doing that. But is there a possibility to
> get a list of some sort of "shortest paths" from one species to
> another, allowing to easily calculate that matrix?
>
>>From the phylip package, I get following data if I run the neighbor or
> fitch program. From there I can easily get an algorithm to calculate
> the distances I need. But I also need to do that for maximum
> likelihood trees and the like. Is there a way to get this information
> in Bio Perl?
>>From to dist
> node1 sp1 xxxxx
> node2 sp3 xxxxxx
> node1 node2 xxxxx
> node 1 sp2 xxxxx
>
> Kind regards
> Joris
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>
More information about the Bioperl-l
mailing list