This is a test version of Biostars. For the public version, visit https://www.biostars.org.
extract EC number from entrez esearch query

Anyone have any idea how to use NCBI's entrez command line (https://www.ncbi.nlm.nih.gov/books/NBK25501/) to extract feature information about a specific protein query? Specifically, I need to find ECid's for given queries.

For example, if I want to programmatically access the ECID for the following protein (Citrate Synthase, EC_number=2.3.3.16), how do I do so?:

https://www.ncbi.nlm.nih.gov/protein/RRJ88579.1

I've need to do this for a large number of proteins, but for now just getting it for one would be great...I've been using queries like "esearch -db protein -query 'RRJ88579.1' | efetch -format docsum," but this does not return the EC number.

entrez ncbi protein genomics ecid

2 answers

xmllint+xpath

$  wget -O - -q "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=protein&id=RRJ88579.1&retmode=xml&rettype=gb"   |\
xmllint --xpath '//GBQualifier[GBQualifier_name="EC_number"]/GBQualifier_value/text()' -

2.3.3.16

Excellent, thank you.

Alternative method I just found:

esearch -db 'protein' -query 'RRJ88579.1' | efetch -format gpc | xtract -insd Protein EC_number

Log in to answer this question.