2
$\begingroup$

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

$\endgroup$
3
  • 1
    $\begingroup$ 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) $\endgroup$
    – Marco
    Oct 18, 2022 at 11:56
  • $\begingroup$ great! Could you please post your script as an answer and accept it so the question can be marked as answered? $\endgroup$
    – terdon
    Oct 18, 2022 at 11:58
  • $\begingroup$ @Marco could you please consider upvoting/accepting the answer. It does help with site stats and its only fair to terdon's answer $\endgroup$
    – M__
    Sep 12, 2023 at 14:23

1 Answer 1

1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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