[Bioperl-l] Bio::*Taxonomy* changes
Sendu Bala
bix at sendu.me.uk
Mon Jul 24 08:21:55 UTC 2006
Hilmar Lapp wrote:
> On Jul 21, 2006, at 12:51 AM, Chris Fields wrote:
>
>> my $db = Bio::DB::Taxonomy->new(-source => 'entrez');
>>
>> # normally not needed as this is set by default internally, but as a
>> demo here...
>> $species->db_handle($db);
>>
>> # reset the appropriate data (genus, species, etc) based on Entrez
>> tax data
>> $species->reset_data(); # this method, BTW, doesn't exist yet but
>> should be easy to implement
>
> Don't call this reset_data() as it may be misleading (usually reset()
> means to revert into a native or original state). Instead, you would
> use fetch_from_db() or something.
>
> However, it seems redundant to me to begin with. If we ignore for a
> second that the return value in the following isn't exactly
> compatible, why would you not just call
>
> $species = $db->get_Taxonomy_Node(-taxonid => $species->ncbi_taxid);
If Bio::Species was a Bio::Taxonomy, and we had FactoryI implementing
classes or similar, we would say:
$species = $factory->fetch(-taxon_id => $species->ncbi_taxid);
> Instead, there should be a separate module (in essence a Bio::Species
> factory) which can translate a Bio::Taxonomy::Node into a
> Bio::Species object - if the rank is 'species' or below.
I don't think a 'translation' module is necessary. Bio::Species can just
be a Bio::Taxonomy.
> At any rate, I think Bio::Taxonomy::Node should be stripped of legacy
> methods that are only there to achieve Bio::Species compatibility.
Yes :)
> I think this would be the way to go. I.e.,
>
>
> |------Node
> NodeI----|
> |-|
> |----SpeciesNode
> Species----|
Actually, if we're changing the name of the module that Species
interacts with, any existing code needs to be re-written. So why not
just do it properly and have Bio::Species interact with Bio::Taxonomy?
|----Bio::Taxonomy
Bio::TaxonomyI----|
|----Bio::Species
Or
Bio::TaxonomyI----|----Bio::Taxonomy----|----Bio::Species
Leaving Node completely free to be just a node. This way we don't have a
crufty SpeciesNode there simply for the sake of Bio::Species.
Bio::Species itself provides all the legacy stuff it needs for itself,
while interacting with Nodes via TaxonomyI methods in the 'correct' way
only.
More information about the Bioperl-l
mailing list