[Bioperl-l] Performance of Bio::Species
Jason Stajich
jason at bioperl.org
Mon Nov 27 04:58:14 UTC 2006
On Nov 25, 2006, at 2:08 PM, Sendu Bala wrote:
> Jason Stajich wrote:
>> The circular ref is from Bio::Species when you have
>> $self->{tree} = Bio::Tree::Tree->new(-root => $self);
>> I added a weaken call in Bio::Species code explicitly -- we can't
>> generally weaken the ref to the root node in Bio::Tree::Tree as
>> that breaks some other things as you saw.
>
> Thanks. Though there's still the issue with
> Bio::Tree::Node::node_cleanup not doing anything.
>
right - well I am not sure that it is going to get called if you have
to remove the cleanup_methods from the object (or does this mean at
all?). I don't have any time to debug it any more so we'll just have
to wait till later to figure it out.
I'd really like to re-visit the tree bjects to see about making them
faster anyways so maybe the memory cycle issue can be revisited as well.
>
>> I'm not sure I am digging what you've done with Bio::Tree::Tree.
>> Why didn't you make a specialized Tree object for Taxonomy stuff
>> so that you can add methods like lineage_node, etc?
>
> http://www.bioperl.org/wiki/Change_log#Bio::Tree::Tree
>
> get_lineage_nodes() was added to Bio::Tree::TreeFunctionsI because
> it's a Tree function. It goes hand in hand with get_lca(), which
> was already there.
>
> I suppose you're saying it would have been more appropriate to have
> a new Tree-based object that only differed in its new() instead of
> adding an option to Tree's new()?
>
> My thinking was that both the -node option and get_lineage_nodes()
> are useful for trees in general, not just Bio::Taxon.
>
I guess I was talking about this code in new() - seems like a
Tree::Taxon object could have been made to deal with the special
case, but probably I am just not seeing the whole picture so no worries.
# to stop us pulling in entire database of a Bio::Taxon when we
later do
# get_nodes() or similar, specifically set ancestor() for each node
if ($node->isa('Bio::Taxon')) {
push(@lineage, $node) unless $node eq $root;
my $ancestor = $root;
foreach my $lineage_node (@lineage) {
$lineage_node->ancestor($ancestor);
} continue { $ancestor = $lineage_node; }
}
--
Jason Stajich
jason at bioperl.org
http://jason.open-bio.org/
More information about the Bioperl-l
mailing list