#!/bin/sh # Public domain notice for all NCBI EDirect scripts is located at: # https://www.ncbi.nlm.nih.gov/books/NBK179288/#chapter6.Public_Domain_Notice # download-sequence BCT PLN if [ "$#" -lt 1 ] then echo "Must have at least one sequence division abbreviation" exit 1 fi filt="grep" while [ "$#" -gt 0 ] do filt=$( echo "$filt -e $1" ) shift done filt=$( echo "$filt" | tr '[A-Z]' '[a-z]' ) download() { nquire -lst ftp.ncbi.nlm.nih.gov ncbi-asn1 | grep "aso.gz" | eval "$filt" | sort -V | skip-if-file-exists | while read fl do echo "$fl" echo "$fl" | nquire -asp ftp.ncbi.nlm.nih.gov ncbi-asn1 done } download if [ $? -ne 0 ] then download fi