[Bioperl-l] Bio::*Taxonomy* changes
Hilmar Lapp
hlapp at gmx.net
Thu Jul 27 01:06:52 EDT 2006
I think this looks like a great solution. You could also name
Bio::DB::Taxonomy::list as Bio::DB::Taxonomy::inmemory because it
really isn't much else than an in-memory database (of limited content
if you populate it from flat-file sequence annotation).
The only reservation I have is that you'd have methods on Node that
don't really operate on the node instance but rather operate on the
taxonomy (database) behind the scenes. That's what I would have used
Bio::Taxonomy for, not so much as a container than as a class with
(conceptually) 'static' methods corresponding to those that are now
in Node, like get_Lineage_Nodes(). They would optionally accept a
db_handle too, or use a default one set as an attribute.
However, leaving/having these methods on Node really isn't such a big
deal and I'm sure would even be preferred by many people for the sake
of simplicity.
So overall I think you should just go ahead.
-hilmar
On Jul 26, 2006, at 1:13 PM, Sendu Bala wrote:
>
> The fine details of the following may be slightly off, but it's
> just to
> provide an example. I'll use Test.pm syntax.
>
> my @human = qw('Homo sapiens' Homo Mammalia Eukaryota);
> my @mouse = qw('Mus musculus' Mus Mammalia Eukaryota);
>
>
> [...]
> Proposed way with Node
> ----------------------
>
> my $db = new Bio::DB::Taxonomy(-source => 'list', -lineage => @human);
> my $h_node = $db->get_Taxonomy_Node(-name => 'Homo sapiens');
> $db->add_lineage(@mouse); # or make a new db
> my $m_node = $db->get_Taxonomy_Node(-name => 'Mus musculus');
>
> @human = map { $_->scientific_name } $h_node->get_Lineage_Nodes;
> ok join(", ", @human), "Homo sapiens, Homo, Mammalia, Eukaryota";
> # works as expected
>
> my $lca = $h_node->get_LCA_Node($m_node);
> ok $lca->scientific_name, 'Mammalia'; # works first time
>
> # try again with entrez - just change the db_handle
> $h_node->db_handle(new Bio:DB::Taxonomy(-source => 'entrez');
>
> @human = map { $_->scientific_name } $h_node->get_Lineage_Nodes;
> ok join(", ", @human) eq "Homo sapiens, Homo, Homo/Pan/Gorilla group,
> Hominidae, ...";
>
> $lca = $h_node->get_LCA_Node($m_node);
> ok $lca->scientific_name, 'Mammalia';
>
> [...]
--
===========================================================
: Hilmar Lapp -:- Durham, NC -:- hlapp at gmx dot net :
===========================================================
More information about the Bioperl-l
mailing list