Question: Retrieving only ENST ids linked to an ENSG ids using the Ensembl REST API
0
gravatar for Fred Fleche
5.2 years ago by
Fred Fleche4.3k
Paris, France
Fred Fleche4.3k wrote:

Hi,

Let's say that I want to programmatically retrieve in json format the 4 Ensembl transcripts IDs that are linked to the Ensembl gene ENSG00000133703 (KRAS) that are listed on the following webpage :

http://www.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=ENSG00000133703;r=12:25357723-25403870

I did give it a try with the following link that gave me extra 9 transcripts that I was not expecting :

http://beta.rest.ensembl.org/feature/id/ENSG00000133703?feature=transcript;content-type=application/json

Does any one know what is the link that returned only the expectes 4 transcripts listed in the first link.

Thanks for your help.

Fred

api ensembl rest • 2.6k views
ADD COMMENTlink modified 5.2 years ago by Emily_Ensembl19k • written 5.2 years ago by Fred Fleche4.3k
2
gravatar for Emily_Ensembl
5.2 years ago by
Emily_Ensembl19k
EMBL-EBI
Emily_Ensembl19k wrote:

The feature/id command in the Beta version of the REST API retrieves all features that overlap the ID that you've put in, not just transcripts of that gene. If we look at the region of the gene, we can see that it overlaps five other transcripts (two genes) on the opposite strand. The feature/id command has been renamed the overlap/id command in the newer full release of the REST API.

At present, I'm afraid there is no command in the REST API to get all transcripts of a gene. You'll have to use the Perl API instead to get this kind of data. It would be something like:

use strict;
use warnings;
 
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::SeqFeature;
my $reg = "Bio::EnsEMBL::Registry";
 
$reg->load_registry_from_db(
   -host => 'ensembldb.ensembl.org',
   -user => 'anonymous'
);

my $gene_adaptor = $reg->get_adaptor ('human', 'core', 'gene');
my $gene = $gene_adaptor->fetch_by_stable_id( 'ENSG00000133703' );
my @transcripts = @{ $gene->get_all_Transcripts };
while (my $transcript = shift @transcripts) {
# print some stuff
}
ADD COMMENTlink written 5.2 years ago by Emily_Ensembl19k
1

You can get them together with their sequences, but I assume that is probably not what you want ....

http://beta.rest.ensembl.org/sequence/id/ENSG00000133703?content-type=application/json;multiple_sequences=1;type=cdna

ADD REPLYlink modified 5.2 years ago • written 5.2 years ago by Bert Overduin3.6k

Thanks for this nice workaround. Even if it would be nicer to have a lighter way to have these transcripts IDs.

ADD REPLYlink written 5.2 years ago by Fred Fleche4.3k

Thanks for you answers. That's a pity that this simple feature is not available through the REST API. Do you know if improvement are planned concerning the REST API.

ADD REPLYlink modified 5.2 years ago • written 5.2 years ago by Fred Fleche4.3k
2

I can feed this back to the developers and see what happens.

ADD REPLYlink written 5.2 years ago by Emily_Ensembl19k

The lookup endpoint might be able to provide you with the information you are looking for:

http://rest.ensembl.org/lookup/id/ENSG00000133703?content-type=application/json;expand=1

Would that fit your use case?

We are always happy to implement new features, so please do give us some feedback on what works and what does not for you.

ADD REPLYlink written 5.0 years ago by Magali_Ensembl130
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1136 users visited in the last hour