[ensembl-dev] protein tree id and tagvalue

Moretti Sébastien sebastien.moretti at unil.ch
Wed Jul 4 13:52:29 BST 2012


>> So now I use GeneTree adaptor, this way, with tree_type = tree (not
>> clusters), and member_type = protein (not ncrna):
>>
>> my $tree_adaptor = $reg->get_adaptor('Multi', 'compara', 'GeneTree');
>> my @children = @{$tree_adaptor->fetch_all(-tree_type => 'tree',
>> -member_type => 'protein')};
>>
>> for my $tree (@children){
>>     my $node_id   = $tree->root->node_id;
>>     my $tax_level = $tree->root->get_tagvalue('taxon_name');
>> }
>>
>>
>>
>> Now my script crashes later on.
>> I check the tree root taxon_name to see if this is the taxonomic level
>> I expect. If this is Bilateria instead of Euteleostomi I want to
>> navigate in the tree until I reach a Euteleostomi node.
>>
>> I used a recursive function that use my $tree object with the children
>> method
>> $tree->children();
>> But children is not a method of Bio::EnsEMBL::Compara::GeneTree
>> and $tree->root->children() does not look to do the right thing.
>>
>> How could I do that ?
>
> children() is indeed not defined in GeneTree but in GeneTreeNode. It
> returns an arrayref of GeneTreeNode. You can call node_id(),
> get_tagvalue(...) on each of them

I cannot make it work.
$tree is a phylogenetic tree object with a Bilateria root (e.g. 
ENSGT00390000000002) defined with a GeneTree adaptor.

If I want to iterate on children nodes of that tree, starting from root, 
I use
my @children = @{$tree->root->sorted_children()}; # or children()


But then it iterates (recursively) endlessly, with a "Deep recursion on 
subroutine" message at some point. I guess the root method is not the 
right one in the following for loop because I get the taxon_name of the 
root of the tree, not the taxon_name of child nodes.

for my $subtree ( @children ){
     $subtree->root->get_tagvalue('taxon_name');
}


How could I manage that ?

Regards
Sébastien

>> An additional question:
>> Now the right way to use release_tree()
>> is $tree->root->release_tree; ?
>
> Yes, you can still use GeneTreeNode::release_tree(). I have not found
> yet a nice (transparent) way of cleaning up the memory
>
> Regards,
> Matthieu

-- 
Sébastien Moretti
Department of Ecology and Evolution,
Biophore, University of Lausanne,
CH-1015 Lausanne, Switzerland
Tel.: +41 (21) 692 4221/4079
http://selectome.unil.ch/ http://bgee.unil.ch/






More information about the Dev mailing list