Odd behaviour - NCBI Eutils
1
0
Entering edit mode
6 weeks ago
npb27 • 0

Hi,

I'm having some weird behaviour for esearch interpreting variables from the bash command line. I have a list of NCBI protein IDs, and I want to obtain the nucleotide database ID for the associated genome/contig as well as the genome length

This works:

esearch -db protein -query "GIR74039.1" | elink -target nuccore | efetch -format docsum

This works:

i="GIR74039.1"
esearch -db protein -query $i | elink -target nuccore | efetch -format docsum

This doesn't work:

INPUT contains only the protein sequence ID shown above

cat INPUT | while read i
do
echo $i
esearch -db protein -query ${i} | elink -target nuccore | efetch -format docsum > temp
done

Here's the error I'm getting

WARNING:  FAILURE ( Mon  4 Mar 15:58:07 GMT 2024 )
 -tool edirect -edirect 16.2 -edirect_os Linux -email XXX@XXX.ac.uk0 -usehistory y -db protein -term GIR74039.1
<ERROR>Empty term and query_key - nothing todo</ERROR>
SECOND ATTEMPT
 WARNING:  FAILURE ( Mon  4 Mar 15:58:09 GMT 2024 )
 -tool edirect -edirect 16.2 -edirect_os Linux -email XXX@XXX.ac.uk0 -usehistory y -db protein -term GIR74039.1
<ERROR>Empty term and query_key - nothing todo</ERROR>
LAST ATTEMPT
 ERROR:  FAILURE ( Mon  4 Mar 15:58:11 GMT 2024 )
 -tool edirect -edirect 16.2 -edirect_os Linux -email XXX@XXX.ac.uk0 -usehistory y -db protein -term GIR74039.1
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE eSearchResult>
<eSearchResult>
  <ERROR>Empty term and query_key - nothing todo</ERROR>
</eSearchResult>
QUERY FAILURE
 ERROR:  WebEnv value not found in elink input
 ERROR:  Missing -db argument

(I censored my email from the output)

I've tried all combinations I can think of single/double quotes and {} around the $i variable, none help

I think the record is still being found by esearch as it's mentioned in the error. This seems like an odd error from esearch

NCBI Eutils esearch Eutilities efetch • 221 views
ADD COMMENT
0
Entering edit mode
6 weeks ago
GenoMax 141k

Can you provide a list of ID's that are failing? Do they work if you try them individually without the while loop?

You may want to use epost method instead of the loop.

ADD COMMENT
0
Entering edit mode

One ID that isn't working is shown in the question, they work individually

Many thanks, I wasn't aware of epost but this solved the issue

This now works:

head -n1 INPUT | while read i
do
echo $i
echo $i | epost -db protein  | elink -target nuccore | efetch -format docsum > temp
done
ADD REPLY

Login before adding your answer.

Traffic: 2723 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