-
Notifications
You must be signed in to change notification settings - Fork 2
/
dmm_gpu.sh
executable file
·270 lines (242 loc) · 6.37 KB
/
dmm_gpu.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#!/bin/bash
# only for server GPU running part
check_exists(){
if [ ! -e "$1" ];then
echo "Can not find $1"
exit 1
fi
}
check_not_exists(){
if [ -e "$1" ];then
echo "Already exists: $1"
exit 1
fi
}
check_empty(){
if [ -z "$1" ];then
echo "****"
echo "Missing Value for $2"
echo "****"
show_help
exit 1
fi
}
function run_commands(){
local command_list=("$@")
local max_jobs=$MAX_Threads
local job_count=0
echo "max_jobs: $max_jobs"
echo "commands: ${command_list[@]}"
for command in "${command_list[@]}"; do
while ((job_count>=max_jobs)); do
sleep 5
job_count=$(jobs -pr|wc -l)
done
#execute command
echo "$command"
eval "$command" &
((job_count++))
done
wait
}
function run_subcommands(){
local command_list=("$@")
local max_jobs=$MAXSUB_Threads
local job_count=0
echo "max_jobs: $max_jobs"
echo "commands: ${command_list[@]}"
for command in "${command_list[@]}"; do
while ((job_count>=max_jobs)); do
sleep 5
job_count=$(jobs -pr|wc -l)
done
#execute command
echo "$command"
eval "$command" &
((job_count++))
done
wait
}
show_help() {
echo "Usage: dmm_full_multithreads.sh [option] -f [FASTA file] -m [MAP file]"
echo "DeepMaimast full-protocol"
echo "Paratemters:"
echo " -h, Show help page"
echo " -A [AlphaFold Model]"
echo " -p [PATH of the programs]"
echo " -m [MAP file]"
echo " -f [Sequence File in FASTA format]"
echo " -c [Contour Level, density cut-off value]"
echo " -o [OutPut Directory Path]"
echo " -t [Time for main-chain tracing (sec)]"
echo " -T [Time for fragment assembly (sec)]"
echo " -C [Max number of threads]"
echo " -M [Max cpu cores per one thread job]"
echo " -r, Resume the job using an existing directory"
echo " -x [Rosetta program PATH], Execute RosettaCM modeling part"
echo " -H, Homo-oligomer targets. DeepMainmast refine chain-assignment."
exit 1
}
#Parameters please edit-----------
## Number of Vehicles for main-chain tracing
Num_vehcles=(5 10 20 40)
## Number of Path-Sequence Alignments per path
Num_alignments=(5 10 20)
## Probability cut-off for CA atoms
Pca_cutoff=(0.3 0.4 0.5)
## Minimum number of aligned positions in the AF2 model
Aligned_positions=(30 50)
## Resolution to generate simulated density from AF2 models
sim_resolutions=(5.0 6.0 7.0)
## GPU
resume_flag=false
Buildfullatom_flag=false
MAX_Threads=8
Nsub=4
af2_mode=false
homo_mode=false
while getopts "A:p:m:f:c:o:t:T:C:rhM:x:H" option; do
case $option in
A)
echo "Option -A: $OPTARG"
af2_model_ori=$OPTARG
check_exists $af2_model_ori
af2_mode=true
;;
H)
echo "Option -H: HomoOligomer Mode"
homo_mode=true
;;
p)
echo "Option -p: $OPTARG"
PROGRAM_PATH=$OPTARG
check_exists $PROGRAM_PATH
;;
m)
echo "Option -m: $OPTARG"
map=$OPTARG
check_exists $map
;;
f)
echo "Option -f: $OPTARG"
fasta=$OPTARG
check_exists $fasta
;;
c)
echo "Option -c: $OPTARG"
CONTOUR=$OPTARG
;;
o)
echo "Option -o: $OPTARG"
output_dir=$OPTARG
;;
t)
echo "Option -t: $OPTARG"
TIME_TRACE=$OPTARG
;;
T)
echo "Option -T: $OPTARG"
TIME_ASB=$OPTARG
;;
r)
echo "Resume Existing Data"
resume_flag=true
;;
C)
echo "Option MAX Threads -C: $OPTARG"
MAX_Threads=$OPTARG
;;
M)
echo "Option Max SubThreads: $OPTARG"
Nsub=$OPTARG
;;
x)
echo "Option -x: $OPTARG"
RosettaPath=$OPTARG
check_exists $RosettaPath
Buildfullatom_flag=true
;;
h)
echo "**HELP**"
show_help
exit
;;
\?)
echo "Invalid option: -$option"
show_help
exit
;;
:)
echo "Option -$OPTARG needs an argument"
show_help
;;
esac
done
echo "#PROGRAM_PATH: $PROGRAM_PATH"
echo "#map: $map"
echo "#fasta: $fasta"
echo "#CONTOUR: $CONTOUR"
echo "#output_dir: $output_dir"
echo "#TIME_TRACE: $TIME_TRACE"
echo "#TIME_Assemble: $TIME_ASB"
echo "#MAX_Threads: $MAX_Threads"
echo "#FullAtom Building: $RosettaPath"
((MAXSUB_Threads=$MAX_Threads/$Nsub)) #each sub-thread use 4 cores
check_empty "$PROGRAM_PATH" "-p"
check_exists $PROGRAM_PATH/server_bin/MainmastC_UnetAF2
check_empty "$CONTOUR" "-c"
check_empty "$output_dir" "-o [output dir]"
check_empty "$TIME_TRACE" "-t [Time for Tracing (sec)]"
check_empty "$TIME_ASB" "-T [Time for Assembly (sec)]"
check_empty "$fasta" "-f [fasta formatfile]"
#Environment-------------
#PLEASE EDIT THIS SECTION ACCORDING TO
#YOUR ENVIRONMENT
#module load miniconda38
#eval "$(conda shell.bash hook)"
## Acitivate the conda enviroment
#module load deepmainmast-multi
#------------------------
#Programs
BIN_DIR="$PROGRAM_PATH/server_bin/"
EMAP2SF=$BIN_DIR/emap2secplus/main_web.py
NODE=$BIN_DIR/MainmastC_Unet_node
###Check Rosetta programs
if "${Buildfullatom_flag}"; then
echo "Checking $RosettaPath"
ROSETTA3=$RosettaPath/main/
RosettaScript=$ROSETTA3/source/bin/rosetta_scripts.static.linuxgccrelease
check_exists $RosettaScript
export ROSETTA3=$RosettaPath/main/
fi
#Set Up files
mkdir -p $output_dir/results/unet
UNET_DIR=$output_dir/results/unet
RESULTS_DIR=$output_dir/results
OUTF=$RESULTS_DIR
OUTCA=$OUTF/FINAL_CA_MODELs/
OUT_RANKED=$OUTF/RANKED_DATA/
if "${resume_flag}";then
echo "INFO: Resuming..."
else
#cp $map $RESULTS_DIR/input.map
cp $map $RESULTS_DIR/input.mrc
cp $fasta $RESULTS_DIR/seq.fasta
fi
SEQ=$RESULTS_DIR/seq.fasta
check_exists $SEQ
#Run Emap2sf----------------------------------
if [ ! -e $UNET_DIR/sigmoidAA_GLN.mrc ]||[ ! -e $UNET_DIR/atom_CB.mrc ];then
#python3 $EMAP2SF --gpu 0 --mode=0 -O $RESULTS_DIR -F=$RESULTS_DIR/input.mrc -M=$BIN_DIR/emap2secplus/best_model/Unet_Protein_Atom.pth.tar --contour=$CONTOUR --batch_size=16 --type=0
python3 $EMAP2SF --mode=0 -O $RESULTS_DIR -F=$RESULTS_DIR/input.mrc -M=$BIN_DIR/emap2secplus/best_model/Unet_Protein_Atom.pth.tar --contour=$CONTOUR --batch_size=16 --type=0
echo "INFO : ATOM prediction Done"
#python3 $EMAP2SF --gpu 0 --mode=0 -O $RESULTS_DIR -F=$RESULTS_DIR/input.mrc -M=$BIN_DIR/emap2secplus/best_model/Unet_Protein_AA.pth.tar --contour=$CONTOUR --batch_size=16 --type=1
python3 $EMAP2SF --mode=0 -O $RESULTS_DIR -F=$RESULTS_DIR/input.mrc -M=$BIN_DIR/emap2secplus/best_model/Unet_Protein_AA.pth.tar --contour=$CONTOUR --batch_size=16 --type=1
echo "INFO : AA prediction Done"
fi
#check output files
if [ ! -e $UNET_DIR/sigmoidAA_GLN.mrc ]||[ ! -e $UNET_DIR/atom_CB.mrc ];then
echo "ERROR : Emap2sf failed"
exit;
fi
echo "DONE" >$output_dir/gpu.out