[ensembl-dev] stable_id by gene name

Emily Perry emily at ebi.ac.uk
Thu Jun 29 10:59:21 BST 2017


Hi Mahmood

The gene sequence page displays 600 bp upstream and downstream of the 
gene. You can get this extra 600 bp by altering your slice adapter call to:
my $slice = $slice_adaptor->fetch_by_gene_stable_id( 'ENSG00000139618', 
600);

This is described in the docs here:
http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1DBSQL_1_1SliceAdaptor.html#a744a0044ea95082ce090e31007417d60

All the best

Emily

On 29/06/2017 10:42, Mahmood Naderan wrote:
> Thanks for the feedback. I have read the tutorial and understood most 
> of it (at least this is what I think!). The main manual which contains 
> all class names and member functions is comprehensive though and need 
> more elaboration...
>
> What $brca_gene->seq prints is not the same as the website. That perl 
> command prints GGGCTTGTGGC.... however the sequence section of the web 
> frontend 
> (http://grch37.ensembl.org/Homo_sapiens/Gene/Sequence?db=core;g=ENSG00000139618;r=13:32889611-32973805) 
> starts withTACCAAGCCC...
>
>
> ​I have to say that ​GGGCTTGTGGC.... is the start of an exon which is 
> inside the printed sequence from the web page.
>
> ​I also double checked with
>
> my $slice = $slice_adaptor->fetch_by_gene_stable_id( 'ENSG00000139618');
> my $sequence = $slice->seq();
> print $sequence, "\n";
>
> ​and it was not the same as the web's output. Is seq() the same as 
> Gene/Sequence?db=core in the URL?​
>
> Regards,
> Mahmood
>
>
>
> On Thu, Jun 29, 2017 at 12:38 PM, mag <mr6 at ebi.ac.uk 
> <mailto:mr6 at ebi.ac.uk>> wrote:
>
>     Hi Mahmood,
>
>     To access all genes in a species, you can use directly the
>     GeneAdaptor.
>     This will allow you to loop through all the genes without having
>     to retrieve the chromosomes first.
>
>     Additionally, there is a method called fetch_all_by_external_name
>     http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1DBSQL_1_1GeneAdaptor.html#a940d6dc7e9273ad373a23eb563a455e6
>     <http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1DBSQL_1_1GeneAdaptor.html#a940d6dc7e9273ad373a23eb563a455e6>
>     which allows you to retrieve all Gene objects for a gene symbol.
>
>     An example script would look like:
>     $registry->load_registry_from_db(
>       -host => 'ensembldb.ensembl.org <http://ensembldb.ensembl.org>',
>       -user => 'anonymous',
>       -port => 3337
>     );
>     my $gene_adaptor = $registry->get_adaptor('human', 'core', 'Gene');
>     my @genes = @{ $gene_adaptor->fetch_all() };
>     my @brca_genes = @{
>     $gene_adaptor->fetch_all_by_external_name('BRCA2') };
>     while (my $brca_gene = shift @brca_genes) {
>       print ">" . $brca_gene->stable_id . " " .
>     $brca_gene->display_xref->display_id . "\n";
>       print $brca_gene->seq . "\n";
>     }
>
>     I would recommend looking through our API course to get more
>     familiar with it.
>     We have slides from our in-person workshops
>     https://github.com/Ensembl/ensembl-presentation/tree/master/API/Core
>     <https://github.com/Ensembl/ensembl-presentation/tree/master/API/Core>
>     a tutorial
>     http://www.ensembl.org/info/docs/api/core/core_tutorial.html
>     <http://www.ensembl.org/info/docs/api/core/core_tutorial.html>
>     and videos
>     http://www.ebi.ac.uk/training/online/course/ensembl-filmed-api-workshop
>     <http://www.ebi.ac.uk/training/online/course/ensembl-filmed-api-workshop>
>
>
>     Hope that helps,
>     Magali
>
>
>
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> Posting guidelines and subscribe/unsubscribe info: http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/

-- 
Dr Emily Perry (Pritchard)
Ensembl Outreach Project Leader

European Bioinformatics Institute (EMBL-EBI)
European Molecular Biology Laboratory
Wellcome Trust Genome Campus
Hinxton
Cambridge
CB10 1SD
UK

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20170629/d13f14ba/attachment.html>


More information about the Dev mailing list