forked from RTXteam/RTX-KG2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextract-uniprotkb.sh
executable file
·39 lines (27 loc) · 1.41 KB
/
extract-uniprotkb.sh
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
#!/usr/bin/env bash
# extract-uniprotkb.sh: download UniProtKB dat distribution and extract to a dat file
# Copyright 2019 Stephen A. Ramsey <[email protected]>
set -o nounset -o pipefail -o errexit
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
echo Usage: "$0 <uniprot_output_file.dat>"
exit 2
fi
echo "================= starting extract-uniprotkb.sh ================="
date
config_dir=`dirname "$0"`
source ${config_dir}/master-config.shinc
uniprotkb_dat_file=${1:-"${BUILD_DIR}/uniprot_sprot.dat"}
uniprotkb_dir=`dirname ${uniprotkb_dat_file}`
mkdir -p ${uniprotkb_dir}
${curl_get} ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.dat.gz \
> ${uniprotkb_dir}/uniprot_sprot.dat.gz
${curl_get} ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/relnotes.txt \
> ${uniprotkb_dir}/relnotes.txt
version_number=`grep -m 1 "UniProt Release" ${uniprotkb_dir}/relnotes.txt | cut -f3 -d ' '`
update_date=`grep -m 1 "${version_number} (" ${uniprotkb_dir}/relnotes.txt | cut -f2 -d ' ' | cut -f2 -d '(' | cut -f1 -d ')'`
start_string="# Version: ${version_number}, Date: ${update_date}"
zcat ${uniprotkb_dir}/uniprot_sprot.dat.gz > /tmp/uniprot_sprot.dat
echo ${start_string} > ${uniprotkb_dat_file}
cat /tmp/uniprot_sprot.dat >> ${uniprotkb_dat_file}
date
echo "================= finished extract-uniprotkb.sh ================="