summaryrefslogtreecommitdiff
path: root/download-sequence
blob: 0e7039fe8a74292e11c7ae5f602e65b6023ca8b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

# Public domain notice for all NCBI EDirect scripts is located at:
# https://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/lxr/source/scripts/projects/blast/LICENSE   

filt=""
while [ "$#" -gt 0 ]
do
  filt=$( echo "$filt -e $1" )
  shift
done

download() {
  nquire -lst ftp.ncbi.nlm.nih.gov ncbi-asn1 |
  grep "aso.gz" | eval "$filt" |
  skip-if-file-exists |
  while read fl
  do
    echo "$fl"
    echo "$fl" |
    nquire -asp  ftp.ncbi.nlm.nih.gov ncbi-asn1
  done
}

if [ -z "$filt" ]
then
  echo "Must have at least one sequence division abbreviation"
  exit 1
fi

filt=$( echo "grep$filt" )
download
if [ $? -ne 0 ]
then
  download
fi