[ensembl-dev] stable_id by gene name

Mahmood Naderan mahmood.nt at gmail.com
Thu Jun 29 10:42:48 BST 2017


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 with TACCAAGCCC...


​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> 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
> 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',
>   -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
> a tutorial
> 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
>
>
> Hope that helps,
> Magali
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20170629/1339cf75/attachment.html>


More information about the Dev mailing list