/
util.sh
123 lines (105 loc) · 2.3 KB
/
util.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
set -x
set -e
if [[ -z ${QIIME_VERSION} ]]; then
QIIME_VERSION=2020.11
fi
source activate qiime2-${QIIME_VERSION}
if [[ -z ${TMI_DATATYPE} ]];
then
echo "No data set!"
exit 1
fi
if [[ -z ${STUDIES} ]] ;
then
echo "No studies specified!"
exit 1
fi
if [[ ${TMI_DATATYPE} == "WGS" ]];
then
redbiom_ctx=Woltka-wol-072020-Woltka-pergenome-200b91-677a58
trim_length=None
min_feature_count=400 # .1% upper bound
min_sample_depth=400000
rarefaction_replacement="with"
ambiguities="merge"
hash_features="False"
else
redbiom_ctx=Deblur-Illumina-16S-V4-100nt-fbc5b2
trim_length=100
min_feature_count=2
min_sample_depth=1000
rarefaction_replacement="no-with"
ambiguities="most-reads"
hash_features="True"
fi
function create_redbiom_contains () {
# convert "foo.bar" -> "'foo','bar'"
# split studies on ".", and put into an array
# https://stackoverflow.com/a/10586169
IFS='.' read -r -a arr <<< "${1}"
rblist=""
for elm in "${arr[@]}"
do
rblist+=\'
rblist+=${elm}
rblist+=\',
done
echo $rblist
}
function tag_even () {
echo "$(tag_treeoverlap).even"
}
function tag_treeoverlap () {
basetag=$(tag_mindepth)
if [[ ${TMI_DATATYPE} == "16S" ]];
then
echo "${basetag}.sepp"
else
echo "${basetag}"
fi
}
function tag_mindepth () {
echo "$(tag_minfeat).mindepth"
}
function tag_minfeat () {
echo "$(tag_nobloom).minfeat"
}
function tag_nobloom () {
basetag=$(tag)
if [[ ${TMI_DATATYPE} == "WGS" ]];
then
# if wgs, we do not filter for bloom
echo "${basetag}"
else
if [[ ${ENV_PACKAGE} == *"human-gut"* ]];
then
# if not wgs, and using human gut samples, we filter for bloom
echo "${basetag}.nobloom"
else
echo "${basetag}"
fi
fi
}
function tag () {
echo "raw"
}
function base () {
if [ -z "${AG_DEBUG}" ]; then
echo "../results/current/${ENV_PACKAGE}"
else
mkdir -p ../current-debug
echo "../current-debug"
fi
}
if [ ! -d "$(base)" ]; then
>&2 echo "$(base) does not exist"
exit 1
fi
d="$(base)/${TMI_DATATYPE}/${STUDIES}"
mkdir -p ${d}
if [ -z "$PBS_NUM_PPN" ]; then
nprocs=1
else
nprocs=$PBS_NUM_PPN
fi