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 :
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
}
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.
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
Thanks for this nice workaround. Even if it would be nicer to have a lighter way to have these transcripts IDs.
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.
I can feed this back to the developers and see what happens.
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.