[Bioperl-l] Local flat file implementation of Bio::DB::Taxonomy

Jason Stajich jason.stajich at duke.edu
Tue Feb 21 16:28:22 UTC 2006


you'll have to do it - I don't have time, I thought there was  
something like this already, but I guess not, so please put it in.  I  
must do this when we initialize the classification array when  
building a node,


On Feb 21, 2006, at 11:10 AM, Gabriel Valiente wrote:

> It works now, with the #!/usr/bin/perl -w switch. Sorry about that.
>
> I'd like to contribute a couple of additional methods to
> Bio::DB::Taxonomy. The first one returns a reference to an array with
> the full lineage of a given node.
>
> sub lineage {
>   my $node = shift;
>   my @PATH;
>   while ($node->node_name ne "root") {
>     $node = $node->get_Parent_Node;
>     unshift @PATH, $node;
>   }
>   return \@PATH;
> }
>
> The second one uses the lineage method to return the most recent  
> common
> ancestor of two given nodes.
>
> sub LCA {
>   my $node1 = shift;
>   my $node2 = shift;
>   my @PATH1 = @{lineage($node1)};
>   my @PATH2 = @{lineage($node2)};
>   my $root1 = shift @PATH1;
>   my $root2 = shift @PATH2;
>   while ($root1->node_name eq $root2->node_name) {
>     $root1 = shift @PATH1;
>     $root2 = shift @PATH2;
>   }
>   return $root1;
> }
>
> Jason, shall I include them myself in Bio::DB::Taxonomy or can you  
> take
> care of this? I think, the right place for these methods might be
> Bio::Taxonomy or Bio::Taxonomy::Node rather than Bio::DB::Taxonomy.
>
> Thanks,
>
> Gabriel
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

--
Jason Stajich
Duke University
http://www.duke.edu/~jes12





More information about the Bioperl-l mailing list