Skip to content

Instantly share code, notes, and snippets.

@eseiler
Created February 14, 2019 09:25
Show Gist options
  • Select an option

  • Save eseiler/0a54435754cd2dd289a2295f7328771d to your computer and use it in GitHub Desktop.

Select an option

Save eseiler/0a54435754cd2dd289a2295f7328771d to your computer and use it in GitHub Desktop.
Download NCBI from accession list
i=0
j=0
s=""
while read line
do
s=$s","$line
((i++))
if [ $i -eq 200 ]
then
echo "Getting batch $j"
curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&rettype=fasta&retmode=text&id=$s" > ref_$j.fasta
((j++))
i=0
s=""
sleep 1.5m
fi
done<accession.list
curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&rettype=fasta&retmode=text&id=$s" > ref_$j.fasta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment