Answers.Body: <p>You can do this using the Entrez API. For example, using the three identifiers from your example, you can do:</p>
  <pre><code>curl &quot;https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&amp;id=XP_025107904.1,PVD22034.1,AJA37836.1&quot; &gt; file.xml
  </code></pre>
  <p>This will bring an XML file with the following contents:</p>
  <pre><code>$ cat file.xml 
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
  &lt;!DOCTYPE eSummaryResult PUBLIC &quot;-//NLM//DTD esummary v1 20041029//EN&quot; &quot;https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20041029/esummary-v1.dtd&quot;&gt;
  &lt;eSummaryResult&gt;
  &lt;DocSum&gt;
      &lt;Id&gt;1397721498&lt;/Id&gt;
      &lt;Item Name=&quot;Caption&quot; Type=&quot;String&quot;&gt;XP_025107904&lt;/Item&gt;
      &lt;Item Name=&quot;Title&quot; Type=&quot;String&quot;&gt;receptor-type tyrosine-protein phosphatase kappa-like isoform X2 [Pomacea canaliculata]&lt;/Item&gt;
      &lt;Item Name=&quot;Extra&quot; Type=&quot;String&quot;&gt;gi|1397721498|ref|XP_025107904.1|[1397721498]&lt;/Item&gt;
      &lt;Item Name=&quot;Gi&quot; Type=&quot;Integer&quot;&gt;1397721498&lt;/Item&gt;
      &lt;Item Name=&quot;CreateDate&quot; Type=&quot;String&quot;&gt;2018/06/07&lt;/Item&gt;
      &lt;Item Name=&quot;UpdateDate&quot; Type=&quot;String&quot;&gt;2018/06/07&lt;/Item&gt;
      &lt;Item Name=&quot;Flags&quot; Type=&quot;Integer&quot;&gt;512&lt;/Item&gt;
      &lt;Item Name=&quot;TaxId&quot; Type=&quot;Integer&quot;&gt;400727&lt;/Item&gt;
      &lt;Item Name=&quot;Length&quot; Type=&quot;Integer&quot;&gt;1271&lt;/Item&gt;
      &lt;Item Name=&quot;Status&quot; Type=&quot;String&quot;&gt;live&lt;/Item&gt;
      &lt;Item Name=&quot;ReplacedBy&quot; Type=&quot;String&quot;&gt;&lt;/Item&gt;
      &lt;Item Name=&quot;Comment&quot; Type=&quot;String&quot;&gt;&lt;![CDATA[  ]]&gt;&lt;/Item&gt;
      &lt;Item Name=&quot;AccessionVersion&quot; Type=&quot;String&quot;&gt;XP_025107904.1&lt;/Item&gt;
  &lt;/DocSum&gt;
  
  &lt;DocSum&gt;
      &lt;Id&gt;1383748625&lt;/Id&gt;
      &lt;Item Name=&quot;Caption&quot; Type=&quot;String&quot;&gt;PVD22034&lt;/Item&gt;
      &lt;Item Name=&quot;Title&quot; Type=&quot;String&quot;&gt;hypothetical protein C0Q70_17837 [Pomacea canaliculata]&lt;/Item&gt;
      &lt;Item Name=&quot;Extra&quot; Type=&quot;String&quot;&gt;gi|1383748625|gb|PVD22034.1||gnl|WGS:PZQS|C0Q70_17837[1383748625]&lt;/Item&gt;
      &lt;Item Name=&quot;Gi&quot; Type=&quot;Integer&quot;&gt;1383748625&lt;/Item&gt;
      &lt;Item Name=&quot;CreateDate&quot; Type=&quot;String&quot;&gt;2018/04/26&lt;/Item&gt;
      &lt;Item Name=&quot;UpdateDate&quot; Type=&quot;String&quot;&gt;2018/04/26&lt;/Item&gt;
      &lt;Item Name=&quot;Flags&quot; Type=&quot;Integer&quot;&gt;0&lt;/Item&gt;
      &lt;Item Name=&quot;TaxId&quot; Type=&quot;Integer&quot;&gt;400727&lt;/Item&gt;
      &lt;Item Name=&quot;Length&quot; Type=&quot;Integer&quot;&gt;602&lt;/Item&gt;
      &lt;Item Name=&quot;Status&quot; Type=&quot;String&quot;&gt;live&lt;/Item&gt;
      &lt;Item Name=&quot;ReplacedBy&quot; Type=&quot;String&quot;&gt;&lt;/Item&gt;
      &lt;Item Name=&quot;Comment&quot; Type=&quot;String&quot;&gt;&lt;![CDATA[  ]]&gt;&lt;/Item&gt;
      &lt;Item Name=&quot;AccessionVersion&quot; Type=&quot;String&quot;&gt;PVD22034.1&lt;/Item&gt;
  &lt;/DocSum&gt;
  
  &lt;DocSum&gt;
      &lt;Id&gt;735659541&lt;/Id&gt;
      &lt;Item Name=&quot;Caption&quot; Type=&quot;String&quot;&gt;AJA37836&lt;/Item&gt;
      &lt;Item Name=&quot;Title&quot; Type=&quot;String&quot;&gt;fucolectin-related molecule [Littorina littorea]&lt;/Item&gt;
      &lt;Item Name=&quot;Extra&quot; Type=&quot;String&quot;&gt;gi|735659541|gb|AJA37836.1|[735659541]&lt;/Item&gt;
      &lt;Item Name=&quot;Gi&quot; Type=&quot;Integer&quot;&gt;735659541&lt;/Item&gt;
      &lt;Item Name=&quot;CreateDate&quot; Type=&quot;String&quot;&gt;2014/12/25&lt;/Item&gt;
      &lt;Item Name=&quot;UpdateDate&quot; Type=&quot;String&quot;&gt;2014/12/25&lt;/Item&gt;
      &lt;Item Name=&quot;Flags&quot; Type=&quot;Integer&quot;&gt;0&lt;/Item&gt;
      &lt;Item Name=&quot;TaxId&quot; Type=&quot;Integer&quot;&gt;31216&lt;/Item&gt;
      &lt;Item Name=&quot;Length&quot; Type=&quot;Integer&quot;&gt;722&lt;/Item&gt;
      &lt;Item Name=&quot;Status&quot; Type=&quot;String&quot;&gt;live&lt;/Item&gt;
      &lt;Item Name=&quot;ReplacedBy&quot; Type=&quot;String&quot;&gt;&lt;/Item&gt;
      &lt;Item Name=&quot;Comment&quot; Type=&quot;String&quot;&gt;&lt;![CDATA[  ]]&gt;&lt;/Item&gt;
      &lt;Item Name=&quot;AccessionVersion&quot; Type=&quot;String&quot;&gt;AJA37836.1&lt;/Item&gt;
  &lt;/DocSum&gt;
  
  &lt;/eSummaryResult&gt;
  </code></pre>
  <p>You can now parse this in your favorite language/parser and get the information you need. I... am not too good with XML so my attempts with <code>xmllint</code> failed, but here's a naive awk approach:</p>
  <pre><code>$ awk -F'[][&gt;&lt;]' '{ if(/Name=&quot;Title&quot;/){desc=$3; spc=$4}else if(/Name=&quot;AccessionVersion&quot;/){name=$3} if($0==&quot;&lt;/DocSum&gt;&quot;){print name,desc,spc; name=&quot;&quot;; desc=&quot;&quot;; spc=&quot;&quot;}}' file.xml 
  XP_025107904.1 receptor-type tyrosine-protein phosphatase kappa-like isoform X2  Pomacea canaliculata
  PVD22034.1 hypothetical protein C0Q70_17837  Pomacea canaliculata
  AJA37836.1 fucolectin-related molecule  Littorina littorea
  </code></pre>
  <p>I stress that this is a very bad idea and you should use a proper XML parser, but it might work...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-17T17:13:12.707Z
Answers.LastActivityDate: 2022-10-17T17:13:12.707Z
Answers.UserDisplayName: terdon
Body: <p>I have a list of protein accessions:</p>
  <pre><code>XP_025107904.1
  PVD22034.1
  AJA37836.1
  </code></pre>
  <p>How can I obtain the definition of the protein, and the related organism?</p>
  <p>Output:</p>
  <pre><code>XP_025107904.1  receptor-type tyrosine-protein phosphatase kappa-like isoform X2  Pomacea canaliculata
  </code></pre>
  <p>Thanks for the help,</p>
  <p>Marco</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-18T11:56:51.327Z
Comments.Text: I solved with a Python script (through biopython):                                                
  from Bio import Entrez
  from Bio import SeqIO                                                                                           
  handle = Entrez.efetch(db="protein", id= input_file, rettype="gb", retmode="text")
  for seq_record in SeqIO.parse(handle, "genbank"):
          print(seq_record.description + "\t" +  seq_record.id)
Comments.UserDisplayName: Marco
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-18T11:58:09.010Z
Comments.Text: great! Could you please post your script as an answer and accept it so the question can be marked as answered?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-12T14:23:19.417Z
Comments.Text: @Marco could you please consider upvoting/accepting the answer. It does help with site stats and its only fair to terdon's answer
Comments.UserDisplayName: M__
Tags: <proteins><phylogenetics><uniprot><identifiers>
Title: Retrieval protein definition from accession ID
ThreadText: # Retrieval protein definition from accession ID
  
  (Asked by: username_0 on 2022-10-17)
  
  I have a list of protein accessions:
  
  ```
  XP_025107904.1
  PVD22034.1
  AJA37836.1
  
  ```
  
  How can I obtain the definition of the protein, and the related organism?
  
  Output:
  
  ```
  XP_025107904.1  receptor-type tyrosine-protein phosphatase kappa-like isoform X2  Pomacea canaliculata
  
  ```
  
  Thanks for the help,
  
  username_0
  
  **Tags:** proteins, phylogenetics, uniprot, identifiers
  
  > **Comments:**
  > **username_0**: I solved with a Python script (through biopython):                                                 from Bio import Entrez from Bio import SeqIO                                                                                            handle = Entrez.efetch(db="protein", id= input_file, rettype="gb", retmode="text") for seq_record in SeqIO.parse(handle, "genbank"):         print(seq_record.description + "\t" +  seq_record.id)  
  > **username_1**: great! Could you please post your script as an answer and accept it so the question can be marked as answered?  
  > **username_2**: @username_0 could you please consider upvoting/accepting the answer. It does help with site stats and its only fair to username_1's answer  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-10-17. Score: 1
  
  You can do this using the Entrez API. For example, using the three identifiers from your example, you can do:
  
  ```
  curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=XP_025107904.1,PVD22034.1,AJA37836.1" > file.xml
  
  ```
  
  This will bring an XML file with the following contents:
  
  ```
  $ cat file.xml 
  <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE eSummaryResult PUBLIC "-//NLM//DTD esummary v1 20041029//EN" "https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20041029/esummary-v1.dtd">
  <eSummaryResult>
  <DocSum>
      <Id>1397721498</Id>
      <Item Name="Caption" Type="String">XP_025107904</Item>
      <Item Name="Title" Type="String">receptor-type tyrosine-protein phosphatase kappa-like isoform X2 [Pomacea canaliculata]</Item>
      <Item Name="Extra" Type="String">gi|1397721498|ref|XP_025107904.1|[1397721498]</Item>
      <Item Name="Gi" Type="Integer">1397721498</Item>
      <Item Name="CreateDate" Type="String">2018/06/07</Item>
      <Item Name="UpdateDate" Type="String">2018/06/07</Item>
      <Item Name="Flags" Type="Integer">512</Item>
      <Item Name="TaxId" Type="Integer">400727</Item>
      <Item Name="Length" Type="Integer">1271</Item>
      <Item Name="Status" Type="String">live</Item>
      <Item Name="ReplacedBy" Type="String"></Item>
      <Item Name="Comment" Type="String"><![CDATA[  ]]></Item>
      <Item Name="AccessionVersion" Type="String">XP_025107904.1</Item>
  </DocSum>
  
  <DocSum>
      <Id>1383748625</Id>
      <Item Name="Caption" Type="String">PVD22034</Item>
      <Item Name="Title" Type="String">hypothetical protein C0Q70_17837 [Pomacea canaliculata]</Item>
      <Item Name="Extra" Type="String">gi|1383748625|gb|PVD22034.1||gnl|WGS:PZQS|C0Q70_17837[1383748625]</Item>
      <Item Name="Gi" Type="Integer">1383748625</Item>
      <Item Name="CreateDate" Type="String">2018/04/26</Item>
      <Item Name="UpdateDate" Type="String">2018/04/26</Item>
      <Item Name="Flags" Type="Integer">0</Item>
      <Item Name="TaxId" Type="Integer">400727</Item>
      <Item Name="Length" Type="Integer">602</Item>
      <Item Name="Status" Type="String">live</Item>
      <Item Name="ReplacedBy" Type="String"></Item>
      <Item Name="Comment" Type="String"><![CDATA[  ]]></Item>
      <Item Name="AccessionVersion" Type="String">PVD22034.1</Item>
  </DocSum>
  
  <DocSum>
      <Id>735659541</Id>
      <Item Name="Caption" Type="String">AJA37836</Item>
      <Item Name="Title" Type="String">fucolectin-related molecule [Littorina littorea]</Item>
      <Item Name="Extra" Type="String">gi|735659541|gb|AJA37836.1|[735659541]</Item>
      <Item Name="Gi" Type="Integer">735659541</Item>
      <Item Name="CreateDate" Type="String">2014/12/25</Item>
      <Item Name="UpdateDate" Type="String">2014/12/25</Item>
      <Item Name="Flags" Type="Integer">0</Item>
      <Item Name="TaxId" Type="Integer">31216</Item>
      <Item Name="Length" Type="Integer">722</Item>
      <Item Name="Status" Type="String">live</Item>
      <Item Name="ReplacedBy" Type="String"></Item>
      <Item Name="Comment" Type="String"><![CDATA[  ]]></Item>
      <Item Name="AccessionVersion" Type="String">AJA37836.1</Item>
  </DocSum>
  
  </eSummaryResult>
  
  ```
  
  You can now parse this in your favorite language/parser and get the information you need. I... am not too good with XML so my attempts with `xmllint` failed, but here's a naive awk approach:
  
  ```
  $ awk -F'[][><]' '{ if(/Name="Title"/){desc=$3; spc=$4}else if(/Name="AccessionVersion"/){name=$3} if($0=="</DocSum>"){print name,desc,spc; name=""; desc=""; spc=""}}' file.xml 
  XP_025107904.1 receptor-type tyrosine-protein phosphatase kappa-like isoform X2  Pomacea canaliculata
  PVD22034.1 hypothetical protein C0Q70_17837  Pomacea canaliculata
  AJA37836.1 fucolectin-related molecule  Littorina littorea
  
  ```
  
  I stress that this is a very bad idea and you should use a proper XML parser, but it might work...
  
  
  ---
  
  