This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to set NCBI entrez to pipe or ignore errors?

I am using the following one-liner with NCBI entrez to query their databases from the terminal:

esearch -db assembly -query ${species name} | xtract -pattern ENTREZ_DIRECT -element Count

which works a charm but occasionally it sends an xml error that messes up the output.

Here is an example of the error:

FAILURE ( Fri Jan 27 01:12:44 PM CST 2023 )
nquire -url https://eutils.ncbi.nlm.nih.gov/entrez/eutils/ esearch.fcgi -retmax 0 -usehistory y -db assembly -term "Crepis commutata" -tool edirect -edirect 18.7 -edirect_os Linux -email {}
<ErrorList>
  <PhraseNotFound>commutata</PhraseNotFound>
  <PhraseNotFound>Crepis commutata[All Fields]</PhraseNotFound>
<ErrorList>
SECOND ATTEMPT

Entrez, unfortunately, does not have a man page or --help entry on my installation for some reason and I am not quite sure where I should change the one-liner to change this behavior.

Does anyone have any clues?

ncbi entrez

My guess is that NCBI does not provide a mechanism to handle these/any errors gracefully. You may need to weed these errors out afterwards from output.

0 answers

No answers yet.

Log in to answer this question.