Entering edit mode
6.0 years ago
Medhat
9.8k
If I tried to get organism name using efetch like:
efetch -db nuccore -id "NC_001422.1" -format docsum | xtract -pattern DocumentSummary -element Organism
result will be: Escherichia virus phiX174
While If I used :
handle = Entrez.efetch(db="nuccore", id="NC_001422.1", rettype="docsum")
There will not be any Organism
element in the output result, Should I used different parameters while using python?
or use Subprocess to run efetch
from command line?
like:
filter_cmd = ['xtract', '-pattern', 'DocumentSummary', '-element', 'Organism']
info_name_cmd = ['efetch', '-db', 'nuccore', '-id', 'NC_001422.1', '-format', 'docsum',]
ps = subprocess.run(info_name_cmd, stdout=subprocess.PIPE)
output = subprocess.check_output((filter_cmd), stdin=ps.stdout)
Thanks.
If one uses python then you can't get the organism name? It is there in results for sure.
As I stated I know that the Organism name exists when using
eftech
from command line, but try the code I suggested in python it will give you only the result you get from running:wget -O - -q "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&rettype=docsum&retmode=xml&id=NC_001422.1"
as Pierre Lindenbaum sugggested which does not contain the Organism only title. (you can try it) .handle = Entrez.efetch(db="nuccore", id="NC_001422.1", rettype="docsum")