[ensembl-dev] Gene adaptor when the species is unknown]

ian Longden ianl at ebi.ac.uk
Wed Jun 29 13:15:03 BST 2011


If you know the stable_id of the gene you could try

get_species_and_object_type

i.e.
my $stable_id = 'ENST00000326632';

                my ( $species, $object_type, $db_type ) =
                  $registry->get_species_and_object_type($stable_id);

                my $adaptor =
                  $registry->get_adaptor( $species, $db_type,
                                          $object_type );

                my $object = $adaptor->fetch_by_stable_id($stable_id);


If you just have a common gene name like "BRCA2" then you would need
to loop over all the gene adaptors and and try fetch

@genes = @{$gene_adaptor->fetch_all_by_external_name('BRCA2')}


-Ian
Ensembl Developer

On Wed, Jun 29, 2011 at 12:44 PM, Susan Fairley <sf7 at sanger.ac.uk> wrote:
> Hi Sebastien,
>
> If you have a DBAdaptor you can then get a gene adaptor without
> mentioning the species.
>
> my $genedb = new Bio::EnsEMBL::DBSQL::DBAdaptor( -host   => $gene_host,
>                                             -user   => $gene_user,
>                                             -pass   => $gene_pass,
>                                             -port   => $gene_port,
>                                             -dbname => $gene_dbname);
>
>
> my $ga = $genedb->get_GeneAdaptor();
>
> Hope this helps.
>
> Regards,
> Susan.
>
>
> Sébastien Moretti wrote:
>>
>> Hi,
>> I wonder if there is another way to create a gene adaptor.
>> I use that but it is linked to a particular species:
>>     my $gene_adaptor = $reg->get_adaptor( 'Human', 'Core', 'Gene' );
>>
>>
>> I would like to get information about genes from ensembl gene identifiers
>> (stable_id) without knowing a priori the species.
>> I.e. what I have to put in the 'Human' place.
>>
>>
>> So, is there something more generic to create gene adaptor ?
>>
>> Best regards
>>
>
>
> _______________________________________________
> 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/
>




More information about the Dev mailing list