I'm downloading translated viral genomes initially via Blast - which had shortcomings - and now by efetch.

What I want to do is obtain a complete list of all translated protein ids from a nucleotide Genbank entry.

efetch -db nucleotide -format gpc -id MT039887 | xtract -insd ....

The protein id and the translated gene sequences are within the efetch -db nucleotide -format gpc -id MT039887 output ... but how do I use xtract to parse them?


If you want the cds in fasta format, try:

esearch -db nucleotide -query MT039887 | efetch -format fasta_cds_na

And for the proteins sequence in fasta format:

elink -db nucleotide -target protein -id MT039887 | efetch -format fasta 
| improve this answer | |
  • $\begingroup$ Wow!! and thank you. Thats the answer ... days like this BioSE works. @zorbax I owe you. "Acknowledgements" thank you heading your way (thats not a metaphor). $\endgroup$ – Michael Feb 27 at 16:33

In case you are still interested in just getting the protein ids and not sequence, you can use xtract like this:

efetch -db nucleotide -format gpc -id MT039887 | xtract  -insd CDS gene product protein_id 
MT039887.1  orf1ab  orf1ab polyprotein           QHZ00388.1
MT039887.1  S       surface glycoprotein         QHZ00389.1
MT039887.1  orf3a   orf3a protein                QHZ00390.1
MT039887.1  E       envelope protein             QHZ00391.1
MT039887.1  M       membrane glycoprotein        QHZ00392.1
MT039887.1  orf6    orf6 protein                 QHZ00393.1
MT039887.1  orf7a   orf7a protein                QHZ00394.1
MT039887.1  orf8    orf8 protein                 QHZ00395.1
MT039887.1  N       nucleocapsid phosphoprotein  QHZ00396.1
MT039887.1  orf10   orf10 protein                QHZ00397.1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.