-
Notifications
You must be signed in to change notification settings - Fork 1
/
DownloadFiles
executable file
·116 lines (69 loc) · 2.63 KB
/
DownloadFiles
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
#***********************************************************
# Script to Download necessary files
# Author : Kumaran Baskaran
# Date : 01.07.2013
#************************************************************
set -e
help="\t\tUsage : $0 \n
\t\t [-o <dir> : Directory to download]\n
\t\tExample : ./Download files -o ~/Downloads "
if (($# == 0)); then
echo "`date +%d/%m/%y-%H:%M:%S` ERROR: Script requires arguments" >&2
echo -e $help
exit 1;
fi
while getopts :o:h opt
do
case $opt in
o) DOWNLOAD=$OPTARG;;
h) echo -e $help;;
\?) echo "`date +%d/%m/%y-%H:%M:%S` ERROR: Invalid option: -$OPTARG" >&2
exit 1;;
:) echo "`date +%d/%m/%y-%H:%M:%S` ERROR: Option -$OPTARG requires an argument." >&2
exit 1;;
esac
done
#===================== Download links =====================================
#UNIPROT_URL="ftp://ftp.expasy.org/databases/uniprot/current_release/uniref/uniref100/uniref100.xml.gz"
UNIPROT_URL="ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/uniref/uniref100/uniref100.xml.gz"
TAXONOMY_URL="http://www.uniprot.org/taxonomy/?query=*&compress=yes&format=tab"
#BLASTDB_URL="ftp://ftp.uniprot.org/pub" # US main ftp
BLASTDB_URL="ftp://ftp.ebi.ac.uk/pub" # UK mirror
SIFTSPDB2UNIPROTFTP="ftp://ftp.ebi.ac.uk/pub/databases/msd/sifts/text/pdb_chain_uniprot.lst"
#====================End Donwload links=====================================
if [ -z $DOWNLOAD ]
then
echo "`date +%d/%m/%y-%H:%M:%S` ERROR: ---------Some Options not specified correctly -------" >&2
echo -e $help
exit 1
fi
if [ ! -d $DOWNLOAD ]
then
mkdir -p $DOWNLOAD || exit 1
fi
echo "`date +%d/%m/%y-%H:%M:%S` INFO: Downloading Uniprot files......"
curl $UNIPROT_URL > $DOWNLOAD/uniref100.xml.gz
if [ $? -ne 0 ]
then
echo "`date +%d/%m/%y-%H:%M:%S` ERROR: Downloading Uniprot file failed.. " >&2
exit 1
fi
echo "`date +%d/%m/%y-%H:%M:%S` INFO: Downloading Uniprot files completed."
echo "`date +%d/%m/%y-%H:%M:%S` INFO: Downloading Taxonomy files......"
curl $TAXONOMY_URL | gunzip > $DOWNLOAD/taxonomy-all.tab || exit 1
if [ $? -ne 0 ]
then
echo "`date +%d/%m/%y-%H:%M:%S` ERROR: Downloading Taxonomy table failed.. " >&2
exit 1
fi
echo "`date +%d/%m/%y-%H:%M:%S` INFO: Downloading Taxonomy files completed."
echo "`date +%d/%m/%y-%H:%M:%S` INFO: Downloading the SIFTS PDB to UNIPROT maping file"
SIFTSPDB2UNIPROT="pdb_chain_uniprot.lst"
curl $SIFTSPDB2UNIPROTFTP > $DOWNLOAD/$SIFTSPDB2UNIPROT
if [ $? -ne 0 ]
then
echo "`date +%d/%m/%y-%H:%M:%S` ERROR: Downloading the SIFTS PDB to UNIPROT maping file failed " >&2
exit 1
fi
echo "`date +%d/%m/%y-%H:%M:%S` INFO: Downloading the SIFTS PDB to UNIPROT maping file completed"