[ensembl-dev] Question about gene names as queries
Kieron Taylor
ktaylor at ebi.ac.uk
Tue Sep 25 15:25:36 BST 2012
Based upon the example requests made, the override flag is probably unnecessary. It only exists to allow specifically unusual short requests. FUT2% should not require any such intervention.
Also, watch the single quotes and their effect on variable names within them.
Kieron
On 25 Sep 2012, at 15:16, Brian Osborne wrote:
> Kieron,
>
> Very nice. So something like:
>
> my $gene = $gene_adaptor->fetch_all_by_external_name('$id%',,1);
>
> Should work and the wild-card will be used?
>
> Thanks again,
>
> Brian O.
>
>
> On Sep 25, 2012, at 9:46 AM, Kieron Taylor <ktaylor at ebi.ac.uk> wrote:
>
>> Hi Brian,
>>
>> If you treat your display id as an external name, you'll find things a lot easier. Ensembl display labels are not necessarily the same as globally recognised labels, or rather there are things with display labels that are not currently named by convention.
>>
>> Take a look at fetch_all_by_external_name() on the Gene Adaptor. There is a small performance penalty involved.
>>
>>
>> Kieron
>>
>> On 25 Sep 2012, at 14:29, Brian Osborne wrote:
>>
>>> To whom it may concern,
>>>
>>> I'm writing simple code using the most recent Perl API, this code downloads sequences using read-able id's like "FUT2". I noticed that when I use this id as a query at ensembl.org I retrieve ~20 genes, and the names of these genes are all "FUT2" except for the chimp gene, which is named "FUT2_PANTR". My code has lines like this:
>>>
>>> my $gene_adaptor = $registry->get_adaptor( $species, 'Core', 'Gene' );
>>> my $gene = $gene_adaptor->fetch_by_display_label($id);
>>>
>>> I would like to be able to loop over all the species (Human, Pig, Chimpanzee, etc.) and get all the FUT2 sequences but I can't get the chimp sequence since wild-cards don't work here (e.g. "$id%").
>>>
>>> Your thoughts?
>>>
>>> Thank you,
>>>
>>> Brian O.
>>> _______________________________________________
>>> Dev mailing list Dev at ensembl.org
>>> List admin (including subscribe/unsubscribe): http://lists.ensembl.org/mailman/listinfo/dev
>>> Ensembl Blog: http://www.ensembl.info/
>>
>> Kieron Taylor PhD.
>> Ensembl Core software developer
>>
>> EMBL - European Bioinformatics Institute
>>
More information about the Dev
mailing list