-
Notifications
You must be signed in to change notification settings - Fork 190
/
translated_search.sh
executable file
·78 lines (68 loc) · 2.13 KB
/
translated_search.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
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
#!/bin/sh -e
# Translated search workflow
fail() {
echo "Error: $1"
exit 1
}
notExists() {
[ ! -f "$1" ]
}
# check amount of input variables
[ "$#" -ne 4 ] && echo "Please provide <sequenceDB> <sequenceDB> <outDB> <tmp>" && exit 1;
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";
QUERY="$1"
QUERY_ORF="$1"
if [ -n "$QUERY_NUCL" ]; then
if notExists "$4/q_orfs.dbtype"; then
# shellcheck disable=SC2086
"$MMSEQS" extractorfs "$1" "$4/q_orfs" ${ORF_PAR} \
|| fail "extract orfs step died"
fi
if notExists "$4/q_orfs_aa.dbtype"; then
# shellcheck disable=SC2086
"$MMSEQS" translatenucs "$4/q_orfs" "$4/q_orfs_aa" ${TRANSLATE_PAR} \
|| fail "translate step died"
fi
QUERY="$4/q_orfs_aa"
QUERY_ORF="$4/q_orfs"
fi
TARGET="$2"
TARGET_ORF="$2"
if [ -n "$TARGET_NUCL" ]; then
if [ -n "$NO_TARGET_INDEX" ]; then
if notExists "$4/t_orfs.dbtype"; then
# shellcheck disable=SC2086
"$MMSEQS" extractorfs "$2" "$4/t_orfs" ${ORF_PAR} \
|| fail "extract target orfs step died"
fi
if notExists "$4/t_orfs_aa.dbtype"; then
# shellcheck disable=SC2086
"$MMSEQS" translatenucs "$4/t_orfs" "$4/t_orfs_aa" ${TRANSLATE_PAR} \
|| fail "translate target step died"
fi
TARGET="$4/t_orfs_aa"
TARGET_ORF="$4/t_orfs"
fi
fi
mkdir -p "$4/search"
if notExists "$4/aln.dbtype"; then
# shellcheck disable=SC2086
"$SEARCH" "${QUERY}" "${TARGET}" "$4/aln" "$4/search" \
|| fail "Search step died"
fi
if notExists "$3.dbtype"; then
# shellcheck disable=SC2086
"$MMSEQS" offsetalignment "$1" "$QUERY_ORF" "$2" "$TARGET_ORF" "$4/aln" "$3" ${OFFSETALIGNMENT_PAR} \
|| fail "Offset step died"
fi
if [ -n "$REMOVE_TMP" ]; then
echo "Remove temporary files"
"$MMSEQS" rmdb "$4/q_orfs"
"$MMSEQS" rmdb "$4/q_orfs_aa"
"$MMSEQS" rmdb "$4/t_orfs"
"$MMSEQS" rmdb "$4/t_orfs_aa"
fi