Retrieving only ENST ids linked to an ENSG ids using the Ensembl REST API
1
0
Entering edit mode
9.8 years ago

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

Ensembl API REST • 4.5k views
ADD COMMENT
2
Entering edit mode
9.8 years ago
Emily 23k

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 COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY
2
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1564 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6