Mercurial > repos > galaxy-australia > alphafold2
annotate scripts/download_uniprot.sh @ 1:6c92e000d684 draft
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit a510e97ebd604a5e30b1f16e5031f62074f23e86"
author | galaxy-australia |
---|---|
date | Tue, 01 Mar 2022 02:53:05 +0000 |
parents | 7ae9d78b06f5 |
children |
rev | line source |
---|---|
0
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
1 #!/bin/bash |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
2 # |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
3 # Copyright 2021 DeepMind Technologies Limited |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
4 # |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
6 # you may not use this file except in compliance with the License. |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
7 # You may obtain a copy of the License at |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
8 # |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
10 # |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
11 # Unless required by applicable law or agreed to in writing, software |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
14 # See the License for the specific language governing permissions and |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
15 # limitations under the License. |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
16 # |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
17 # Downloads, unzips and merges the SwissProt and TrEMBL databases for |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
18 # AlphaFold-Multimer. |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
19 # |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
20 # Usage: bash download_uniprot.sh /path/to/download/directory |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
21 set -e |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
22 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
23 if [[ $# -eq 0 ]]; then |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
24 echo "Error: download directory must be provided as an input argument." |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
25 exit 1 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
26 fi |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
27 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
28 if ! command -v aria2c &> /dev/null ; then |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
29 echo "Error: aria2c could not be found. Please install aria2c (sudo apt install aria2)." |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
30 exit 1 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
31 fi |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
32 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
33 DOWNLOAD_DIR="$1" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
34 ROOT_DIR="${DOWNLOAD_DIR}/uniprot" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
35 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
36 TREMBL_SOURCE_URL="ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_trembl.fasta.gz" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
37 TREMBL_BASENAME=$(basename "${TREMBL_SOURCE_URL}") |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
38 TREMBL_UNZIPPED_BASENAME="${TREMBL_BASENAME%.gz}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
39 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
40 SPROT_SOURCE_URL="ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
41 SPROT_BASENAME=$(basename "${SPROT_SOURCE_URL}") |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
42 SPROT_UNZIPPED_BASENAME="${SPROT_BASENAME%.gz}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
43 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
44 mkdir --parents "${ROOT_DIR}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
45 aria2c "${TREMBL_SOURCE_URL}" --dir="${ROOT_DIR}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
46 aria2c "${SPROT_SOURCE_URL}" --dir="${ROOT_DIR}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
47 pushd "${ROOT_DIR}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
48 gunzip "${ROOT_DIR}/${TREMBL_BASENAME}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
49 gunzip "${ROOT_DIR}/${SPROT_BASENAME}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
50 |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
51 # Concatenate TrEMBL and SwissProt, rename to uniprot and clean up. |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
52 cat "${ROOT_DIR}/${SPROT_UNZIPPED_BASENAME}" >> "${ROOT_DIR}/${TREMBL_UNZIPPED_BASENAME}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
53 mv "${ROOT_DIR}/${TREMBL_UNZIPPED_BASENAME}" "${ROOT_DIR}/uniprot.fasta" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
54 rm "${ROOT_DIR}/${SPROT_UNZIPPED_BASENAME}" |
7ae9d78b06f5
"planemo upload for repository https://github.com/usegalaxy-au/galaxy-local-tools commit 7b79778448363aa8c9b14604337e81009e461bd2-dirty"
galaxy-australia
parents:
diff
changeset
|
55 popd |