Issue with NCBI esearch
1
0
Entering edit mode
11 weeks ago
yp19 ▴ 70

Hi all,

I'm trying to retrieve some taxonomy information using esearch from NCBI, I have a list of tax IDs (one per line) in a file called ids.txt

I'm running this code and it keeps failing, I've checked all previous resolved posts about this issue and I followed the same syntax. Any ideas what's going on here?

my code:

cat ids.txt | while read line;
do
echo $line;
esearch -db taxonomy -query “$line[taxID]"
done

and the error message:

> sed: RE error: illegal byte sequence 
> ERROR: Missing -query argument

I tried removing the "taxID" part from the query to see if that was the problem, but then I get another error:

cat ids.txt | while read line;
> do
> echo $line;
> esearch -db taxonomy -query $line
> done
 WARNING:  FAILURE ( Fri  7 May 2021 15:46:57 EDT )
nquire -url https://eutils.ncbi.nlm.nih.gov/entrez/eutils/ esearch.fcgi -retmax 0 -usehistory y -db taxonomy -term $'743375\r' -tool edirect -edirect 15.0 -edirect_os Darwin -email 
<ERROR>Empty term and query_key - nothing todo</ERROR>
ncbi esearch edirect • 221 views
ADD COMMENT
2
Entering edit mode
11 weeks ago
vkkodali ★ 2.6k

This looks like a line ending (see https://en.wikipedia.org/wiki/Newline) issue. Please run mac2unix on your ids.txt file before you run the command. That should change the line endings to unix style. For the first command, try "${line}[TaxID]"

ADD COMMENT
0
Entering edit mode

This fixed the issue, thank you very much!

ADD REPLY

Login before adding your answer.

Traffic: 1642 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6