<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>

CC BY-SA 4.0
2022-10-17T17:13:12.707Z
2022-10-17T17:13:12.707Z
terdon
<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>

CC BY-SA 4.0
2022-10-18T11:56:51.327Z
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)
Marco
CC BY-SA 4.0
2022-10-18T11:58:09.010Z
great! Could you please post your script as an answer and accept it so the question can be marked as answered?
terdon
CC BY-SA 4.0
2023-09-12T14:23:19.417Z
@Marco could you please consider upvoting/accepting the answer. It does help with site stats and its only fair to terdon's answer
M__
<proteins><phylogenetics><uniprot><identifiers>
Retrieval protein definition from accession ID
# 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,
Marco

**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**: @Marco could you please consider upvoting/accepting the answer. It does help with site stats and its only fair to terdon'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 




    1397721498
    XP_025107904
    receptor-type tyrosine-protein phosphatase kappa-like isoform X2 [Pomacea canaliculata]
    gi|1397721498|ref|XP_025107904.1|[1397721498]
    1397721498
    2018/06/07
    2018/06/07
    512
    400727
    1271
    live
    
      
    XP_025107904.1



    1383748625
    PVD22034
    hypothetical protein C0Q70_17837 [Pomacea canaliculata]
    gi|1383748625|gb|PVD22034.1||gnl|WGS:PZQS|C0Q70_17837[1383748625]
    1383748625
    2018/04/26
    2018/04/26
    0
    400727
    602
    live
    
      
    PVD22034.1



    735659541
    AJA37836
    fucolectin-related molecule [Littorina littorea]
    gi|735659541|gb|AJA37836.1|[735659541]
    735659541
    2014/12/25
    2014/12/25
    0
    31216
    722
    live
    
      
    AJA37836.1




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==""){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...


---

