Answers.Body: <p>If you want the cds in fasta format, try:</p>
  
  <pre><code>esearch -db nucleotide -query MT039887 | efetch -format fasta_cds_na
  </code></pre>
  
  <p>And for the proteins sequence in fasta format:</p>
  
  <pre><code>elink -db nucleotide -target protein -id MT039887 | efetch -format fasta 
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-27T16:33:32.973Z
Answers.Text: 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).
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-27T15:51:05.097Z
Answers.LastActivityDate: 2020-02-27T15:51:05.097Z
Answers.UserDisplayName: zorbax
Answers.Body: <p>In case you are still interested in just getting the protein ids and not sequence, you can use <code>xtract</code> like this: </p>
  
  <pre><code>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
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-10T20:43:53.647Z
Answers.Text: Thank you, this is really useful.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-29T13:37:06.470Z
Answers.LastActivityDate: 2020-04-29T13:37:06.470Z
Answers.UserDisplayName: vkkodali
Body: <p>I'm downloading translated viral genomes initially via Blast - which had shortcomings - and now by <code>efetch</code>.</p>
  
  <p>What I want to do is obtain a complete list of all translated protein ids from a nucleotide Genbank entry.</p>
  
  <pre><code>efetch -db nucleotide -format gpc -id MT039887 | xtract -insd ....
  </code></pre>
  
  <p>The protein id and the translated gene sequences are within the <code>efetch -db nucleotide -format gpc -id MT039887</code> output ... but how do I use <code>xtract</code> to parse them?</p>
  
Tags: <genome><phylogeny><phylogenetics><efetch>
Title: efetch nucleotide -> protein ids
ThreadText: # efetch nucleotide -> protein ids
  
  (Asked by: username_0 on 2020-02-26)
  
  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?
  
  **Tags:** genome, phylogeny, phylogenetics, efetch
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-02-27. Score: 1 | Accepted answer
  
  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 
  
  ```
  
  > **Comments:**
  > **username_0**: Wow!! and thank you. Thats the answer ... days like this BioSE works. @username_1 I owe you. "Acknowledgements" thank you heading your way (thats not a metaphor).  
  
  ---
  
  ### Answer by username_2 on 2020-04-29. Score: 1
  
  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
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you, this is really useful.  
  
  ---
  
  