Deleted:conda ncbi_datasets summary loop command error
0
0
Entering edit mode
2.2 years ago

The following bash code generates an empty .json file named by the first line it read from the text file and never proceeds to the command cat in the for loop command below or proceeds to read the next line in the text file. What should I change in this for loop to work with the conda ncbi_datasets summary command?

For loop bash code:

cat > species.txt
Dubosiella newyorkensis
Bacteroides thetaiotaomicron
ctrl^D

SPECIES="species.txt"

while read line; do 
  FNAM="${line/ /_}"
  datasets summary genome taxon "$line" --reference --limit all >  ${FNAM}.json
  cat ${FNAM}.json | jq -r '.assemblies[].assembly|[.assembly_accession,.org.tax_id,.org.sci_name] | @text' > ./lists/species/${FNAM}.txt
done <$SPECIES

Successful bash code without for loop for single entry:

datasets summary genome taxon "Bacteroides thetaiotaomicron" --reference --limit all >  Bacteroidesthetaiotaomicron.json
cat Bacteroidesthetaiotaomicron.json | jq -r '.assemblies[].assembly|[.assembly_accession,.org.tax_id,.org.sci_name] | @text' > ./lists/species/Bacteroidesthetaiotaomicron.txt
ncbi_datasets error summary • 458 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2553 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