This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Ensembl REST requests for CDS sequences returning AA sequences

Hi,

I'm trying to use the Ensembl REST API to retrieve CDS sequences which works great most of the time, but occasionally it returns an amino acid sequence instead. Here's an example:

guest-028-002-021: User$ curl 'http://rest.ensemblgenomes.org/sequence/id/GLYMA13G38430.1?content-type=text/x-fasta;type=cds'
>GLYMA13G38430.1
MPAGIMIPARNMPSMIGRNGTVGGFGLSSGLSLGQIENHKASESQRSEEMFQPNLMEAGQ
LHPLDMPQNTSESDVPRIREDDFDSATKSGSENLEGASGEDQDPRPNKKKRYHRHTQHQI
QEMEAFFKECPHPDDKQRKELSRELGLEPLQVKFWFQNKRTQMKTQHERHENTQLRTENE
KLRADNMRFREALGNASCPNCGGPTAIGEMSFDEHHLRLENARLREEIDRISAIAAKYVG
KPVVSYPLVSPSSIPPRPLELGIGGGFGGQPGGTGGDMYGGAAGDLLRSISGPTEADKPI
IIELAVAAMEELIGMAQMGEPLWLTTLDGTTVLNEDEYIRSFPRGIGPKPAGFKFEASRE
TAVVIMNHVNLVEILMDVNQWSTVFAGIVSRAMTLEVLSTGVAGNYNGALQVMTAEVQVP
SPLVPTRESYFVRYCKQHGDGTWAVVDVSLDNLRPSPSARCRRRPSGCLIQEMPNGYSKV
IWVEHVEVDDRGVHNLYKQLVSSGHAFGAKRWVATLDRQCERLASAMATNIPTVDVGVIT
NQDGRKSMLKLAERMVISFCAGVSASTAHTWTTLSGTGADDVRVMTRKSVDDPGRPPGIV
LSAATSFWLPVSPKRVFEFLRDENSRSEWDILSNGGVVQEMAHIANGRDTGNCVSLLRVN
SANSSQSNMLILQESCADSTGSFVIYAPVDIVAMNVVLNGGDPDYVALLPSGFAILPDGT
TAHGGGIGDTGHGGSLLTVAFQILVDSVPTAKLSLGSVATVNNLIACTVERIKAALSGEV
A

Am I doing something wrong? GLYMA13G38430.1 is a valid TranscriptID when I look it up on the Ensembl Genomes website. I'm stumped. I'd appreciate any suggestions that folks might have. Thanks!

cds ensembl rest

Not sure at the moment. Fairly sure it's not you. In touch with our developers to find out.

2 answers

Ok so this is caused by the reuse of stable identifiers between the different object types we have. GLYMA13G38430.1 is reused for both the transcript and translation stable identifier. The underlying Perl API is struggling to know which one you're requesting. You can get around this by forcing it to look for transcripts which will give you the CDS:

curl 'http://rest.ensemblgenomes.org/sequence/id/GLYMA13G38430.1?content-type=text/x-fasta;type=cds;object_type=transcript'

Hope this helps and sorry for the confusion.

Great. That seems to be working perfectly. Thanks a lot.

If you have many sequences to fetch and don't mind a little python, pyGeno could also be good alternative.

Log in to answer this question.