[ensembl-dev] GeneTree deprecated tag

Matthieu Muffato muffato at ebi.ac.uk
Wed Apr 1 17:13:09 BST 2015


Dear Daniel,

We regularly have to refactor our APIs to deal with new types of data / 
analyses that we are importing / generating. In the best scenario (from 
our users point of view), the external interface remains the same and 
new methods / fields are added. In other cases, we really need to 
rearrange the objects.
Methods / objects are usually deprecated for a while (2 to 8 releases, 
say, depending of their estimated importance for the users) before being 
removed. In fact, some methods are never removed because it is deemed 
too dangerous (you can find some methods that have been deprecated for 
more than 6 years !).

Regards,
Matthieu

On 31/03/15 15:21, Caffrey, Daniel wrote:
> Dear Ensembl developers,
>
> This is not a complaint, but I just wanted to make it known that changes to method names like this do have ripple effects. My group research group uses more than one version of Ensembl (depending on the age of the project) and we had to refactor some of our code to handle the different methods for different versions.  It wasn't a major inconvenience, and I understand that  occasional changes like this are sometimes needed.
>
> However, one the APIs appealing features is that the majority of class names and methods that we use have remained unchanged (even when the underlying schema has probably changed a lot). I'm hoping this will be the case in the future and you can clarify/confirm your philosophy regarding future changes to method names.
>
> Thanks,
>
> Daniel
>
>
>
> On Mar 31, 2015, at 5:43 AM, Matthieu Muffato <muffato at ebi.ac.uk>
>   wrote:
>
>> Hi Sébastien,
>>
>> Yes, the taxonomy annotation can now be fetched this way:
>> $gene_tree_node->species_tree_node();  [returns a SpeciesTreeNode object]
>> $gene_tree_node->species_tree_node()->node_name;
>> $gene_tree_node->species_tree_node()->taxon_id;
>> $gene_tree_node->species_tree_node()->taxon;    [returns a NCBITaxon object]
>> $gene_tree_node->species_tree_node()->taxon->left_index;
>>
>> Matthieu
>>
>> On 30/03/15 16:20, Sébastien Moretti wrote:
>>> Hi
>>>
>>> found solution at
>>> http://lists.ensembl.org/pipermail/dev/2014-December/010674.html
>>>
>>> Next time I will search there before ;-)
>>> The worst being that it was asked by a colleague next door.
>>>
>>>> Hi
>>>>
>>>> I used to use
>>>>     $taxon_level = $tree->get_value_for_tag('taxon_name');
>>>> with $tree as GeneTree adaptor.
>>>>
>>>> With Ensembl API 79, it looks get_value_for_tag (or get_tagvalue) method
>>>> is deprecated
>>>> And "taxon_name" tag is also deprecated.
>>>>
>>>> It is now recommended to use species_tree_node method but it does not
>>>> work with "taxon_name" tag.
>>>> ERR: Can't call method "left_index" on an undefined value
>>>>
>>>>
>>>> So what is the proper way to get it now?
>>>>
>>>>
>>>> CODE:
>>>> my $reg = 'Bio::EnsEMBL::Registry';
>>>> $reg->load_registry_from_db(
>>>>              ...
>>>> );
>>>> my $tree_adaptor       = $reg->get_adaptor('Multi', 'compara',
>>>> 'GeneTree');
>>>> my $ncbi_taxon_adaptor = $reg->get_adaptor('Multi', 'compara',
>>>> 'NCBITaxon');
>>>>
>>>> my $tree    = $tree_adaptor->fetch_by_root_id(375021); # id example
>>>> my $tax_level = $tree->species_tree_node('taxon_name');
>>>> my $deepest_node_tax =
>>>> $ncbi_taxon_adaptor->fetch_node_by_name($tax_level);
>>>> my $left_tax         = $deepest_node_tax->left_index;
>>>>
>>>> Regards
>>>




More information about the Dev mailing list