-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdmm_full_multithreads.sh
executable file
·803 lines (720 loc) · 20.4 KB
/
dmm_full_multithreads.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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
#!/bin/bash
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
}
function run_single_command(){
local command_list=("$@")
local max_jobs=1
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 CPU cores]"
echo " -M [Max cpu cores per one task]"
echo " -r [PATH of result** directory], 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."
echo " -F, Using reduced parameters for fast computing"
echo " -s, Using server mode. Only Generate 1 full-atom model/initial model."
exit 1
}
resume_flag=false
Buildfullatom_flag=false
MAX_Threads=8
Nsub=4
af2_mode=false
homo_mode=false
fast_mode=false
server_mode=false
while getopts "A:p:m:f:c:o:t:T:C:r:hM:x:HFs" 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
;;
F)
echo "Option -F: Using Reduced Parameters. FAST Mode"
fast_mode=true
;;
s)
echo "Option -s: Generate one full atom model/initial CA model"
server_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: $OPTARG"
resume_flag=true
RESUME_DIR=$OPTARG
;;
C)
echo "Option MAX Number of CPU cores -C: $OPTARG"
MAX_Threads=$OPTARG
;;
M)
echo "Option Max SubThreads per task: $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
#Parameters please edit-----------
#Full parameters
## 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)
#Fast reduced parameters
if "${fast_mode}";then
Num_vehcles=(5 10 20)
Num_alignments=(5 10)
Pca_cutoff=(0.3) #reduced
Aligned_positions=(30 50)
sim_resolutions=(5.0)
fi
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
#rand_tag=`python -c "import random, string; print(''.join(random.choices(string.ascii_letters + string.digits, k=8)))"`
rand_tag=''
RESULTS_DIR=$output_dir/results
#Attempt 3 times
if [ -e $RESULTS_DIR ];then
rand_tag=`python -c "import random, string; print(''.join(random.choices(string.ascii_letters + string.digits, k=8)))"`
RESULTS_DIR=$output_dir/results${rand_tag}
fi
if [ -e $RESULTS_DIR ];then
rand_tag=`python -c "import random, string; print(''.join(random.choices(string.ascii_letters + string.digits, k=8)))"`
RESULTS_DIR=$output_dir/results${rand_tag}
fi
if [ -e $RESULTS_DIR ];then
echo "Can not generate new dir: $RESULTS_DIR"
exit
fi
mkdir -p $RESULTS_DIR/unet
UNET_DIR=$RESULTS_DIR/unet
OUTF=$RESULTS_DIR
OUTCA=$OUTF/FINAL_CA_MODELs/
OUT_RANKED=$OUTF/RANKED_DATA/
cp $map $RESULTS_DIR/input.mrc
#Check non-standerd characters and coding
python3 $BIN_DIR/format_seq.py $fasta --OutPath $RESULTS_DIR/seq.fasta
#cp $fasta $RESULTS_DIR/seq.fasta
SEQ=$RESULTS_DIR/seq.fasta
check_exists $SEQ
##AF2 Model check
if "${af2_mode}";then
#Renumber and assign chain ID
RENUM=$BIN_DIR/Renum_chain.py
af2_model=$RESULTS_DIR/AF2_renum.pdb
if [ ! -e $af2_model ];then
python3 $RENUM $SEQ $af2_model_ori --OutPath $af2_model
fi
check_exists $af2_model
fi
#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
com_list=()
#C-alpha Node Detection-----------------------
for p in ${Pca_cutoff[@]}
do
out=$RESULTS_DIR/NODE_p$p.pdb
if [ ! -e $out ];then
cmd="$NODE -i $UNET_DIR -s $SEQ -t $p -G > $out"
com_list+=("$cmd")
fi
done
#echo "$com_list"
run_commands "${com_list[@]}"
echo "INFO : C-alpha Node computing Done"
#Path tracing by VRP solver----------------###
com_list=()
ASB=$BIN_DIR/UnetPathEdge.py #Large penalties for edges with Pbb=0
for p in ${Pca_cutoff[@]}
do
for Nchain in ${Num_vehcles[@]}
do
in=$RESULTS_DIR/NODE_p${p}.pdb
out=$RESULTS_DIR/PATH_p${p}Nch${Nchain}.csv
log=$RESULTS_DIR/PATH_p${p}Nch${Nchain}.log
if [ ! -e $log ];then
cmd="python $ASB $in --Nchain $Nchain --OutCSV $out --SecTrace $TIME_TRACE &> $log"
com_list+=("$cmd")
fi
done
done
run_commands "${com_list[@]}"
echo "INFO : Path Tracing by VRP Done"
##Generate INP file
com_list=()
PG=$BIN_DIR/MainmastC_UnetAF2
ASB=$BIN_DIR/Assemble_Iter.py
for p in ${Pca_cutoff[@]}
do
for Nchain in ${Num_vehcles[@]}
do
in=$OUTF/PATH_p${p}Nch${Nchain}.csv
UnetDir=$UNET_DIR
if [ ! -e $in ];then
echo "Missing.... $in"
continue
fi
for Nali in ${Num_alignments[@]}
do
INP=$OUTF/INP_p${p}Nch${Nchain}Nali${Nali}.txt
if [ ! -e $INP ];then
cmd="$PG -i $UnetDir -s $SEQ -G -N $in -l 9 -r 1.5 -c 1 -T $Nali > $INP"
com_list+=("$cmd")
fi
if "${af2_mode}";then
for Rsize in ${Aligned_positions[@]};do
INP=$OUTF/INP_p${p}Nch${Nchain}Nali${Nali}R${Rsize}.txt
if [ ! -e $INP ];then
cmd="$PG -i $UnetDir -s $SEQ -G -N $in -l 9 -r 1.5 -c 1 -T $Nali -R $Rsize -A $af2_model > $INP"
com_list+=("$cmd")
fi
done
fi
done
done
done
run_commands "${com_list[@]}"
echo "INFO : generating INP file Done"
##Assemble Fragments
com_list=()
ASB=$BIN_DIR/Assemble_Iter.py
OUTF=$RESULTS_DIR
for p in ${Pca_cutoff[@]}
do
for Nchain in ${Num_vehcles[@]}
do
in=$OUTF/PATH_p${p}Nch${Nchain}.csv
UnetDir=$UNET_DIR
if [ ! -e $in ];then
echo "Missing.... $in"
continue
fi
for Nali in ${Num_alignments[@]}
do
INP=$OUTF/INP_p${p}Nch${Nchain}Nali${Nali}.txt
OUT=$OUTF/OUT_p${p}Nch${Nchain}Nali${Nali}.pdb
log=$OUTF/OUT_p${p}Nch${Nchain}Nali${Nali}.log
if [ -e $INP ] && [ ! -e $OUT ];then
cmd="python $ASB --Nstock 10000 --Niter 3 $INP --OutPath $OUT --Ncpu $Nsub --SecAssemble $TIME_ASB &> $log"
com_list+=("$cmd")
fi
if "${af2_mode}";then
for Rsize in ${Aligned_positions[@]};do
INP=$OUTF/INP_p${p}Nch${Nchain}Nali${Nali}R${Rsize}.txt
OUT=$OUTF/OUT_p${p}Nch${Nchain}Nali${Nali}R${Rsize}.pdb
log=$OUTF/OUT_p${p}Nch${Nchain}Nali${Nali}R${Rsize}.log
if [ -e $INP ] && [ ! -e $OUT ];then
cmd="python $ASB --Nstock 10000 --Niter 3 $INP --OutPath $OUT --Ncpu $Nsub --SecAssemble $TIME_ASB &> $log"
com_list+=("$cmd")
fi
done
fi
done
done
done
run_subcommands "${com_list[@]}"
echo "INFO : Assembling Done"
#VESPER DOCKING--------
if "${af2_mode}";then
##Set Up simulated maps
VESPER_DIR=$OUTF/VESPER_MODELs
PG1=$BIN_DIR/SplitPDBchain.py
PG2=$BIN_DIR/btpdb2mrc.py
PG3=$BIN_DIR/VESPER_Power_colab
PG4=$BIN_DIR/RotateVesper.py
mkdir -p $VESPER_DIR
#Split PDB to chains
python $PG1 $af2_model --OutPath=$VESPER_DIR/af2
com_list=()
for reso in ${sim_resolutions[@]}
do
for input_model in $VESPER_DIR/af2_?.pdb $VESPER_DIR/af2_??.pdb
do
model_id=`basename $input_model .pdb`
map_model=$VESPER_DIR/${model_id}_R${reso}.mrc
if [ ! -e $map_model ]&& [ -e $input_model ];then
cmd="python $PG2 $reso $input_model $map_model"
com_list+=("$cmd")
fi
done
done
run_commands "${com_list[@]}"
##VESPER DOCKING
com_list=()
for reso in ${sim_resolutions[@]}
do
for input_model in $VESPER_DIR/af2_?.pdb $VESPER_DIR/af2_??.pdb
do
model_id=`basename $input_model .pdb`
map_model=$VESPER_DIR/${model_id}_R${reso}.mrc
outfile=$VESPER_DIR/${model_id}_R${reso}.out
if [ ! -e $outfile ] && [ -e $map_model ] && [ -e $map ];then
#cmd="$PG3 -a $map -b $map_model -t $CONTOUR -T 10.0 -c $Nsub -g 8.0 -s 1.0 > $outfile"
cmd="$PG3 -a $map -b $map_model -t $CONTOUR -T 1.0 -c 2 -g 8.0 -s 1.0 > $outfile"
com_list+=("$cmd")
fi
done
done
run_single_command "${com_list[@]}"
##Generate Fitted Models
for reso in ${sim_resolutions[@]}
do
for input_model in $VESPER_DIR/af2_?.pdb $VESPER_DIR/af2_??.pdb
do
model_id=`basename $input_model .pdb`
outfile=$VESPER_DIR/${model_id}_R${reso}.out
first_model=$VESPER_DIR/${model_id}_R${reso}_FIT_MODEL0.pdb
if [ -e $outfile ] && [ ! -e $first_model ];then
python3 $PG4 $outfile $input_model --OutPath $VESPER_DIR/${model_id}_R${reso}_
fi
done
done
echo "INFO : VESPER DOCKING Done"
fi
##COMBINATION===================================
echo "INFO : Combine All Models"
PG_ASB=$BIN_DIR/MainmastC_UnetAssembleMtx
PG=$BIN_DIR/Assemble_Iter.py #combine all models
comb_model2=$OUTF/COMBINEi_DMonly.pdb
log=$OUTF/COMBINEi_DMonly.log
#Generate MODLES file
modelfile=$OUTF/MODELs_DMonly.pdb
if [ ! -e $modelfile ];then
for Nali in ${Num_alignments[@]}; do
for p in $OUTF/OUT_p*ali$Nali.pdb; do
cat $p
echo "TER"
done;done > $modelfile
fi
if "${af2_mode}";then
modelfile=$OUTF/MODELs_all.pdb
if [ ! -e $modelfile ];then
for p in $OUTF/OUT_p*.pdb
do
cat $p
echo "TER"
done > $modelfile
fi
modelfile=$OUTF/MODELs_AFonly.pdb
if [ ! -e $modelfile ];then
if [ -e $OUTF/VESPER_MODELs ];then
for p in $OUTF/OUT_p*R*.pdb
do
cat $p
echo "TER"
done > $modelfile
else
echo "Running without AF model output"
fi
fi
modelfile=$OUTF/MODELs_VESPER.pdb
if [ ! -e $modelfile ];then
if [ -e $OUTF/VESPER_MODELs ];then
for p in $OUTF/VESPER_MODELs/*FIT_MODEL?.pdb
do
cat $p
echo "TER"
done > $modelfile
else
echo "Running without AF model output"
fi
fi
fi
#generate MTX files
PG_ASB=$BIN_DIR/MainmastC_UnetAssembleMtx
com_list=()
for method in DMonly all AFonly VESPER; do
mtxfile=$OUTF/MTX_${method}.txt
modelfile=$OUTF/MODELs_${method}.pdb
if [ ! -e $mtxfile ] && [ -e $modelfile ];then
cmd="$PG_ASB -i $UnetDir -s $SEQ -l 10 -A $modelfile -G -c $Nsub > $mtxfile"
com_list+=("$cmd")
fi
done
run_subcommands "${com_list[@]}"
#COMBINE all models
com_list=()
for method in DMonly all AFonly VESPER; do
mtxfile=$OUTF/MTX_${method}.txt
comb_model=$OUTF/COMBi_${method}.pdb
log=$OUTF/COMBi_${method}.log
if [ -e $mtxfile ] && [ ! -e $comb_model ];then
cmd="python $PG $mtxfile --Nstock 10000 --OutPath $comb_model --SecAssemble $TIME_ASB --Ncpu $Nsub > $log"
com_list+=("$cmd")
fi
done
run_subcommands "${com_list[@]}"
echo "INFO : Combine All Models Done"
if "${homo_mode}";then
PG_ASB=$BIN_DIR/MainmastC_UnetChainAssign
PG=$BIN_DIR/Assemble_ReChainID.py
Filter=-10.0
DiffCut=3.0
com_list=()
for method in DMonly all AFonly VESPER; do
mtxfile=$OUTF/CH_MTX_${method}.txt
modelfile=$OUTF/COMBi_${method}.pdb
if [ ! -e $mtxfile ] && [ -e $modelfile ];then
cmd="$PG_ASB -i $UnetDir -s $SEQ -A $modelfile -H -f $Filter -r $DiffCut > $mtxfile"
com_list+=("$cmd")
fi
done
run_commands "${com_list[@]}"
#chain assignment
com_list=()
for method in DMonly all AFonly VESPER; do
mtxfile=$OUTF/CH_MTX_${method}.txt
output_file=$OUTF/COMBi_${method}_rechain.pdb
log=$OUTF/COMBi_${method}_rechain.log
if [ -e $mtxfile ] && [ ! -e $output_file ];then
cmd="python $PG $mtxfile --HomWeight 1.0 --Nstock 10000 --OutPath $output_file --SecAssemble $TIME_ASB --Ncpu $Nsub > $log"
com_list+=("$cmd")
fi
done
run_subcommands "${com_list[@]}"
echo "INFO : Chain-Assignments Done"
fi
##Make Copies
mkdir -p $OUTCA
for method in DMonly all AFonly VESPER; do
ca_file=$OUTF/COMBi_${method}.pdb
if "${homo_mode}";then
ca_file=$OUTF/COMBi_${method}_rechain.pdb
fi
outfile=$OUTCA/COMBi_${method}.pdb
if [ -e $ca_file ];then
cp $ca_file $outfile
fi
done
echo "INFO : DAQ scoring for CA models"
DAQ=$BIN_DIR/DAQscore_Unet
com_list=()
for method in DMonly all AFonly VESPER; do
comb_model=$OUTCA/COMBi_${method}.pdb
DAQ_OUT=$OUTCA/COMBi_${method}.daq
if [ -e $comb_model ] && [ ! -e $DAQ_OUT ];then
cmd="$DAQ -i $UnetDir -Q $comb_model > $DAQ_OUT"
com_list+=("$cmd")
fi
done
run_commands "${com_list[@]}"
#WindowSize 9
#WINDOW_PG=$BIN_DIR/DAQwindow.py
#for method in DMonly all AFonly VESPER; do
# DAQ_OUT=$OUTCA/COMBINEi_${method}.daq
# if [ -e $DAQ_OUT ];then
## python3 $WINDOW_PG $DAQ_OUT 9 --OutPath $OUTCA/COMBINEi_${method}_
# fi
#done
echo "INFO : DAQ scoring Done"
##DOT Scoring
PG=$BIN_DIR/VESPER_Power_colab
for method in DMonly all AFonly VESPER; do
ca_model=$OUTCA/COMBi_${method}.pdb
ca_dot=$OUTCA/COMBi_${method}.dot
new_map=$OUTCA/COMBi_${method}.mrc
if [ -e $ca_model ] && [ ! -e $ca_dot ];then
#simulate map
python3 $BIN_DIR/btpdb2mrc.py 5.0 $ca_model $new_map
$PG -a $map -b $new_map -t 0.001 -T 1.0 -c 4 -g 8.0 -e -s 2.0 > $ca_dot
fi
done
##Ranking CA models
echo "INFO : DOT scoring Done"
echo "INFO : CA modeling Done"
python $BIN_DIR/ca_ranker.py $OUTCA
##Window19 models
PG=$BIN_DIR/DAQwindow.py
for mid in {1..4};do #Max 4 CA models
daq_file=$OUTCA/rank${mid}.daq
if [ -e $daq_file ];then
python $PG $daq_file 9 --OutPath $OUTCA/rank${mid}_
fi
done
if ! "${Buildfullatom_flag}";then
echo "INFO : DeepMainmast Computation Done: CA models"
check_exists $OUTCA/rank1_daq_score_w9.pdb
cp $OUTCA/rank1_daq_score_w9.pdb $output_dir/DeepMainmast${rand_tag}.pdb
echo "DONE" >$output_dir/done.out
exit
fi
##Rosetta CM part---------------------
##SetUp Rosetta files
echo "INFO : Start RosettaCM"
PG=$BIN_DIR/RosettaCM.py
for method in DMonly all AFonly VESPER; do
ca_model=$OUTCA/COMBi_${method}.pdb
cm_dir=$OUTCA/CM_${method}/
if [ -e $ca_model ] && [ ! -e $cm_dir ];then
python3 $PG $SEQ $ca_model $map --OutPath=$cm_dir --XMLPath=$BIN_DIR --PulchraPath=$BIN_DIR/pulchra
fi
done
com_list=()
for method in DMonly all AFonly VESPER; do
ca_model=$OUTCA/COMBi_${method}.pdb
cm_dir=$OUTCA/CM_${method}/
if [ -e $cm_dir ] && [ -e $cm_dir/A_setup.sh ] && [ ! -e $cm_dir/1tmpA_thread.pdb ];then
cmd="bash $cm_dir/A_setup.sh $cm_dir/"
com_list+=("$cmd")
fi
done
run_commands "${com_list[@]}"
#Run RosettaCM, generate five models for each method
com_list=()
for method in DMonly all AFonly VESPER; do
ca_model=$OUTCA/COMBi_${method}.pdb
cm_dir=$OUTCA/CM_${method}/
log=$OUTCA/CM_${method}.log
if [ -e $cm_dir ] && [ -e $cm_dir/A_setup.sh ] && [ -e $cm_dir/C_rosettaCM.sh ] && [ ! -e $log ];then
cmd="bash $cm_dir/C_rosettaCM.sh $cm_dir 5 > $log"
if "${server_mode}";then #Generate one model
cmd="bash $cm_dir/C_rosettaCM.sh $cm_dir 1 > $log"
fi
com_list+=("$cmd")
fi
done
run_commands "${com_list[@]}"
#Evaluation
echo "INFO : DAQ scoring for Full-atom models"
DAQ=$BIN_DIR/DAQscore_Unet
com_list=()
for method in DMonly all AFonly VESPER; do
for mid in 1 2 3 4 5; do
FullAtomModel=$OUTCA/CM_${method}/S_singletgt_000${mid}.pdb
DAQ_OUT=$OUTCA/CM_${method}/S_singletgt_000${mid}.daq
echo "$DAQ_OUT"
if [ -e $FullAtomModel ] && [ ! -e $DAQ_OUT ];then
cmd="$DAQ -i $UnetDir -Q $FullAtomModel > $DAQ_OUT"
com_list+=("$cmd")
fi
done
done
run_commands "${com_list[@]}"
##DOT Scoring
PG=$BIN_DIR/VESPER_Power_colab
for method in DMonly all AFonly VESPER; do
for mid in 1 2 3 4 5; do
FullAtomModel=$OUTCA/CM_${method}/S_singletgt_000${mid}.pdb
FullDot=$OUTCA/CM_${method}/S_singletgt_000${mid}.dot
new_map=$OUTCA/CM_${method}/S_singletgt_000${mid}.mrc
if [ -e $FullAtomModel ] && [ ! -e $FullDot ];then
#simulate map
python3 $BIN_DIR/btpdb2mrc.py 5.0 $FullAtomModel $new_map
$PG -a $map -b $new_map -t 0.001 -T 1.0 -c 4 -g 8.0 -e -s 2.0 > $FullDot
fi
done
done
mkdir -p $OUT_RANKED
python $BIN_DIR/full_ranker.py $OUTCA $OUT_RANKED
##Window19 models
PG=$BIN_DIR/DAQwindow.py
for mid in {1..20};do #Max 20 models
daq_file=$OUT_RANKED/rank${mid}.daq
if [ -e $daq_file ];then
python $PG $daq_file 9 --OutPath $OUT_RANKED/rank${mid}_
fi
done
#Check Files....
#Final Model has 4 models.
#Rank1 CA model
# Filtered Model
#Rank1 Full-Atom Model
# Filtered Model
if "${Buildfullatom_flag}";then
echo "INFO : DeepMainmast Computation Done with FullAtom Model"
check_exists $OUT_RANKED/rank1_daq_score_w9.pdb
cat $OUTCA/rank1_daq_score_w9.pdb $OUT_RANKED/rank1_daq_score_w9.pdb > $output_dir/DeepMainmast${rand_tag}.pdb
#cp $OUT_RANKED/rank1_daq_score_w9.pdb $output_dir/DeepMainmast${rand_tag}.pdb
echo "DONE" >$output_dir/done.out
exit
fi