-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftdmp-qa-all
executable file
·877 lines (783 loc) · 27 KB
/
ftdmp-qa-all
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
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
#!/bin/bash
function print_help_and_exit
{
cat >&2 << 'EOF'
'ftdmp-qa-all' scores and ranks multimeric structures of proteins or nucleic acids
Options:
--workdir string * path to directory for caching and writing detailed results
--subselect-contacts string query to subselect inter-chain contacts for scoring, default is '[]'
--constraints-required string query to check required inter-chain contacts, default is ''
--constraints-banned string query to check banned inter-chain contacts, default is ''
--constraint-clashes number max allowed clash score, default is ''
--subselect-atoms-global string query to subselect atoms for global scores, default is '[]'
--reference string input structure file to compute CAD-score with, default is ''
--ftdmp-root string ftdmp root path, default is '' (autodetected from the calling command)
--conda-path string conda installation path, default is ''
--conda-early string flag to activate conda as early as possible
--conda-env string conda main environment name, default is ''
--processors number number of processes to run when scoring, default is 8
--sbatch string sbatch parameters to run scoring in parallel, default is ''
--score-symmetry string flag to score symmetry, default is 'false'
--external-scores string path to input file with external scores table, default is ''
--remap-cadscore string flag to use optimal chains remapping for CAD-score, default is 'false'
--crude-cadscore string flag to use faster but crude mode for CAD-score
--keep-top-fast number number of top complexes to keep after full scoring stage, default is 9999999
--keep-top-slow number number of top complexes to keep before slow full scoring stage, default is 9999999
--limit-voromqa-light number minimal allowed VoroMQA-light whole-stricture score, default is ''
--rank-names string rank names to use, or name of a standard set of rank names, default is 'protein_protein_voromqa_and_global_and_gnn_no_sr'
--ranks-top number number of top complexes to consider for each ranking, default is 300
--jury-slices string slice sizes sequence definition for ranks jury scoring, default is '5 20'
--jury-cluster number clustering threshold for ranks jury scoring, default is 0.9
--jury-maxs number number of max values to use for ranks jury scoring, default is 1
--output-redundancy-threshold number minimal ordered redundancy value to accept, default is 0.9
--plot-jury-scores string file path to output plot of jury scores, default is ''
--plot-jury-diagnostics string flag to plot jury diagnostics, default is 'false'
--write-pdb-file string file path template to output scores in PDB files, default is ''
--write-pdb-mode string mode for PDB scores output ('voromqa_dark' or 'voromqa_dark_and_gnn'), default is 'voromqa_dark_and_gnn'
--write-pdb-num number number of top PDB files with scores to write, default is 5
--write-full-table string file path to output full table, default is ''
--help | -h flag to display help message and exit
Standard input:
input file paths
Standard output:
space-separated table of scores
Examples:
ls ./*.pdb | ftdmp-qa-all --conda-path ~/miniconda3 --workdir './tmp/works' --rank-names protein_protein_voromqa_and_global_and_gnn_no_sr
ls ./*.pdb | ftdmp-qa-all --workdir './tmp/works' --rank-names protein_protein_voromqa_no_sr
ls ./*.pdb | ftdmp-qa-all --conda-path ~/miniconda3 --workdir './tmp/works' --rank-names protein_protein_voromqa_and_global_and_gnn_no_sr \
--write-pdb-file './output/scored_-RANK-_-BASENAME-' --write-pdb-mode 'voromqa_dark_and_gnn' --write-pdb-num 5
Named collections of rank names, to be provided as a single string to '--rank-names':
protein_protein_voromqa_and_global_and_gnn_no_sr
protein_protein_voromqa_and_global_and_gnn_with_sr
protein_protein_voromqa_and_gnn_no_sr
protein_protein_voromqa_and_gnn_with_sr
protein_protein_voromqa_no_sr
protein_protein_voromqa_with_sr
protein_protein_simplest_voromqa
generalized_voromqa
EOF
exit 1
}
################################################################################
if [ -z "$1" ]
then
print_help_and_exit
fi
WORKDIR=""
INTERFACE_SUBSELECTION="[]"
CONSTRAINTS_REQUIRED=""
CONSTRAINTS_BANNED=""
CONSTRAINT_CLASHES=""
SUBSELECT_ATOMS_FOR_GLOBAL="[]"
REFERENCE_STRUCTURE_FILE_FOR_COMPARISON=""
FTDMP_ROOT=""
CONDA_PATH=""
CONDA_EARLY="false"
CONDA_ENV=""
SCORING_PROCESSORS="8"
SCORING_SBATCH=""
SCORE_SYMMETRY="false"
EXTERNAL_SCORES_FILE=""
REMAP_CADSCORE="false"
CRUDE_CADSCORE="false"
KEEP_TOP_FAST="9999999"
KEEP_TOP_SLOW="9999999"
LIMIT_VOROMQA_LIGHT=""
SCORING_RANKS="protein_protein_voromqa_and_global_and_gnn_no_sr"
SCORING_RANKS_TOP="300"
SCORING_RANKS_JURY_SLICES="5 20"
SCORING_RANKS_JURY_CLUSTER="0.9"
SCORING_RANKS_JURY_MAX_VALUES="1"
REDUNDANCY_THRESHOLD="0.9"
PLOT_JURY_SCORES=""
PLOT_JURY_DIAGNOSTICS="false"
WRITE_SCORES_PDB_FILE=""
WRITE_SCORES_PDB_MODE="voromqa_dark_and_gnn"
WRITE_SCORES_PDB_NUM="5"
WRITE_FULL_TABLE=""
HELP_MODE="false"
while [[ $# > 0 ]]
do
OPTION="$1"
OPTARG="$2"
shift
case $OPTION in
--workdir)
WORKDIR="$OPTARG"
shift
;;
--subselect-contacts)
INTERFACE_SUBSELECTION="$OPTARG"
shift
;;
--constraints-required)
CONSTRAINTS_REQUIRED="$OPTARG"
shift
;;
--constraints-banned)
CONSTRAINTS_BANNED="$OPTARG"
shift
;;
--constraint-clashes)
CONSTRAINT_CLASHES="$OPTARG"
shift
;;
--subselect-atoms-global)
SUBSELECT_ATOMS_FOR_GLOBAL="$OPTARG"
shift
;;
--reference)
REFERENCE_STRUCTURE_FILE_FOR_COMPARISON="$OPTARG"
shift
;;
--openmm-forcefield)
OPENMM_FORCEFIELD="$OPTARG"
shift
;;
--ftdmp-root)
FTDMP_ROOT="$OPTARG"
shift
;;
--conda-path)
CONDA_PATH="$OPTARG"
shift
;;
--conda-early)
CONDA_EARLY="$OPTARG"
shift
;;
--conda-env)
CONDA_ENV="$OPTARG"
CONDA_ENV_FOR_GNN="$OPTARG"
shift
;;
--processors)
SCORING_PROCESSORS="$OPTARG"
shift
;;
--sbatch)
SCORING_SBATCH="$OPTARG"
shift
;;
--score-symmetry)
SCORE_SYMMETRY="$OPTARG"
shift
;;
--external-scores)
EXTERNAL_SCORES_FILE="$OPTARG"
shift
;;
--remap-cadscore)
REMAP_CADSCORE="$OPTARG"
shift
;;
--crude-cadscore)
CRUDE_CADSCORE="$OPTARG"
shift
;;
--keep-top-fast)
KEEP_TOP_FAST="$OPTARG"
shift
;;
--keep-top-slow)
KEEP_TOP_SLOW="$OPTARG"
shift
;;
--limit-voromqa-light)
LIMIT_VOROMQA_LIGHT="$OPTARG"
shift
;;
--rank-names)
SCORING_RANKS="$OPTARG"
shift
;;
--ranks-top)
SCORING_RANKS_TOP="$OPTARG"
shift
;;
--jury-slices)
SCORING_RANKS_JURY_SLICES="$OPTARG"
shift
;;
--jury-cluster)
SCORING_RANKS_JURY_CLUSTER="$OPTARG"
shift
;;
--jury-maxs)
SCORING_RANKS_JURY_MAX_VALUES="$OPTARG"
shift
;;
--output-redundancy-threshold)
REDUNDANCY_THRESHOLD="$OPTARG"
shift
;;
--plot-jury-scores)
PLOT_JURY_SCORES="$OPTARG"
shift
;;
--plot-jury-diagnostics)
PLOT_JURY_DIAGNOSTICS="$OPTARG"
shift
;;
--write-pdb-file)
WRITE_SCORES_PDB_FILE="$OPTARG"
shift
;;
--write-pdb-mode)
WRITE_SCORES_PDB_MODE="$OPTARG"
shift
;;
--write-pdb-num)
WRITE_SCORES_PDB_NUM="$OPTARG"
shift
;;
--write-full-table)
WRITE_FULL_TABLE="$OPTARG"
shift
;;
-h|--help)
HELP_MODE="true"
;;
*)
echo >&2 "Error: invalid command line option '$OPTION'"
exit 1
;;
esac
done
if [ "$HELP_MODE" == "true" ]
then
print_help_and_exit
fi
[ -n "$WORKDIR" ] || { echo >&2 "Error: working directory path not provided"; exit 1;}
[ -n "$INTERFACE_SUBSELECTION" ] || { echo >&2 "Error: contacts subselection not defined"; exit 1; }
[ -n "$SCORING_RANKS" ] || { echo >&2 "Error: scoring rank names not provided"; exit 1;}
[ -n "$SCORING_RANKS_JURY_SLICES" ] || { echo >&2 "Error: scoring ranks jury slices not defined"; exit 1;}
if [ -n "$WRITE_SCORES_PDB_FILE" ] && [ "$WRITE_SCORES_PDB_NUM" -gt "0" ] && [ "$WRITE_SCORES_PDB_MODE" != "voromqa_dark" ] && [ "$WRITE_SCORES_PDB_MODE" != "voromqa_dark_and_gnn" ]
then
echo >&2 "Error: invalid mode '$WRITE_SCORES_PDB_MODE' for writing scores in PDB files"
exit 1
fi
################################################################################
readonly TMPLDIR=$(mktemp -d)
trap "rm -r $TMPLDIR" EXIT
cat \
| tr ' ' '\n' \
| egrep '.' \
| sort \
| uniq \
> "$TMPLDIR/input_list"
if [ ! -s "$TMPLDIR/input_list" ]
then
echo >&2 "Error: no input in stdin"
exit 1
fi
NUMBER_OF_INPUT_FILES="$(wc -l $TMPLDIR/input_list | awk '{print $1}')"
INPUT_FILE_PATH_PREFIX="$(dirname $(head -n 1 $TMPLDIR/input_list))/"
while read -r SINGLEINFILE
do
if [ ! -s "$SINGLEINFILE" ]
then
echo >&2 "Error: no input file '$SINGLEINFILE'"
exit 1
fi
SINGLEINFILE_PATH_PREFIX="$(dirname ${SINGLEINFILE})/"
if [ "$SINGLEINFILE_PATH_PREFIX" != "$INPUT_FILE_PATH_PREFIX" ]
then
echo >&2 "Error: input files do not have the same path prefix"
exit 1
fi
done < "$TMPLDIR/input_list"
################################################################################
if [ "$SCORING_RANKS" == "generalized_voromqa" ]
then
SCORING_RANKS="
raw_FIVb_iface_energy_rank
raw_FIVb_energy_clash_tour_rank
"
fi
if [ "$SCORING_RANKS" == "protein_protein_simplest_voromqa" ]
then
SCORING_RANKS="
raw_FIV_iface_energy_rank
raw_FIV_energy_clash_tour_rank
"
fi
if [ "$SCORING_RANKS" == "protein_protein_voromqa_no_sr" ]
then
SCORING_RANKS="
raw_FIV_iface_energy_rank
raw_FIV_energy_clash_tour_rank
raw_FIVb_iface_energy_rank
raw_FIVb_energy_clash_tour_rank
"
fi
if [ "$SCORING_RANKS" == "protein_protein_voromqa_with_sr" ]
then
SCORING_RANKS="
raw_FIV_iface_energy_rank
raw_FIV_energy_clash_tour_rank
raw_FIVb_iface_energy_rank
raw_FIVb_energy_clash_tour_rank
raw_FIV_sr_iface_energy_rank
raw_FIV_sr_energy_clash_tour_rank
raw_FIVb_sr_iface_energy_rank
raw_FIVb_sr_energy_clash_tour_rank
"
fi
if [ "$SCORING_RANKS" == "protein_protein_voromqa_and_gnn_no_sr" ]
then
SCORING_RANKS="
raw_FIV_iface_energy_rank
raw_FIV_energy_clash_tour_rank
raw_FIVb_iface_energy_rank
raw_FIVb_energy_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_rank
raw_FIGNN_average_gnn_score_rank
raw_FIGNN_gnn_scores_tour_rank
raw_FIGNN_average_pcadscore_rank
raw_FIGNN_weighted_average_pcadscore_rank
raw_FIGNN_sum_of_gnn_scores_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIV_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIV_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIV_energy_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIVb_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIVb_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIVb_energy_tour_rank
"
fi
if [ "$SCORING_RANKS" == "protein_protein_voromqa_and_gnn_with_sr" ]
then
SCORING_RANKS="
raw_FIV_iface_energy_rank
raw_FIV_energy_clash_tour_rank
raw_FIVb_iface_energy_rank
raw_FIVb_energy_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_rank
raw_FIGNN_average_gnn_score_rank
raw_FIGNN_gnn_scores_tour_rank
raw_FIGNN_average_pcadscore_rank
raw_FIGNN_weighted_average_pcadscore_rank
raw_FIGNN_sum_of_gnn_scores_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIV_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIV_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIV_energy_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIVb_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIVb_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIVb_energy_tour_rank
raw_FIV_sr_iface_energy_rank
raw_FIV_sr_energy_clash_tour_rank
raw_FIVb_sr_iface_energy_rank
raw_FIVb_sr_energy_clash_tour_rank
raw_FIGNN_sr_sum_of_gnn_scores_rank
raw_FIGNN_sr_average_gnn_score_rank
raw_FIGNN_sr_gnn_scores_tour_rank
raw_FIGNN_sr_average_pcadscore_rank
raw_FIGNN_sr_weighted_average_pcadscore_rank
raw_FIGNN_sr_sum_of_gnn_scores_clash_tour_rank
raw_FIGNN_sr_sum_of_gnn_scores_FIV_sr_energy_tour_rank
raw_FIGNN_sr_avg_gnn_score_FIV_sr_energy_tour_rank
raw_FIGNN_sr_wavg_pcadscore_FIV_sr_energy_tour_rank
raw_FIGNN_sr_sum_of_gnn_scores_FIVb_sr_energy_tour_rank
raw_FIGNN_sr_avg_gnn_score_FIVb_sr_energy_tour_rank
raw_FIGNN_sr_wavg_pcadscore_FIVb_sr_energy_tour_rank
"
fi
if [ "$SCORING_RANKS" == "protein_protein_voromqa_and_global_and_gnn_no_sr" ]
then
SCORING_RANKS="
raw_FIV_iface_energy_rank
raw_FIV_energy_clash_tour_rank
raw_FIVb_iface_energy_rank
raw_FIVb_energy_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_rank
raw_FIGNN_average_gnn_score_rank
raw_FIGNN_gnn_scores_tour_rank
raw_FIGNN_average_pcadscore_rank
raw_FIGNN_weighted_average_pcadscore_rank
raw_FIGNN_sum_of_gnn_scores_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIV_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIV_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIV_energy_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIVb_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIVb_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIVb_energy_tour_rank
raw_FIV_and_FGV_light_tour_rank
raw_FIV_and_FGV_dark_tour_rank
raw_FIGNN_and_FGV_light_tour_rank
raw_FIGNN_and_FGV_dark_tour_rank
"
fi
if [ "$SCORING_RANKS" == "protein_protein_voromqa_and_global_and_gnn_with_sr" ]
then
SCORING_RANKS="
raw_FIV_iface_energy_rank
raw_FIV_energy_clash_tour_rank
raw_FIVb_iface_energy_rank
raw_FIVb_energy_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_rank
raw_FIGNN_average_gnn_score_rank
raw_FIGNN_gnn_scores_tour_rank
raw_FIGNN_average_pcadscore_rank
raw_FIGNN_weighted_average_pcadscore_rank
raw_FIGNN_sum_of_gnn_scores_clash_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIV_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIV_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIV_energy_tour_rank
raw_FIGNN_sum_of_gnn_scores_FIVb_energy_tour_rank
raw_FIGNN_avg_gnn_score_FIVb_energy_tour_rank
raw_FIGNN_wavg_pcadscore_FIVb_energy_tour_rank
raw_FIV_and_FGV_light_tour_rank
raw_FIV_and_FGV_dark_tour_rank
raw_FIGNN_and_FGV_light_tour_rank
raw_FIGNN_and_FGV_dark_tour_rank
raw_FIV_sr_iface_energy_rank
raw_FIV_sr_energy_clash_tour_rank
raw_FIVb_sr_iface_energy_rank
raw_FIVb_sr_energy_clash_tour_rank
raw_FIGNN_sr_sum_of_gnn_scores_rank
raw_FIGNN_sr_average_gnn_score_rank
raw_FIGNN_sr_gnn_scores_tour_rank
raw_FIGNN_sr_average_pcadscore_rank
raw_FIGNN_sr_weighted_average_pcadscore_rank
raw_FIGNN_sr_sum_of_gnn_scores_clash_tour_rank
raw_FIGNN_sr_sum_of_gnn_scores_FIV_sr_energy_tour_rank
raw_FIGNN_sr_avg_gnn_score_FIV_sr_energy_tour_rank
raw_FIGNN_sr_wavg_pcadscore_FIV_sr_energy_tour_rank
raw_FIGNN_sr_sum_of_gnn_scores_FIVb_sr_energy_tour_rank
raw_FIGNN_sr_avg_gnn_score_FIVb_sr_energy_tour_rank
raw_FIGNN_sr_wavg_pcadscore_FIVb_sr_energy_tour_rank
"
fi
if [[ $SCORING_RANKS == "file:"* ]]
then
SCORING_RANKS="$(cat "$(echo ${SCORING_RANKS} | sed 's|^file:||')" | tr '\n' ' ')"
fi
SCORING_RANKS="$(echo ${SCORING_RANKS} | tr '\n' ' ' | sed 's/\s\+/ /g' | sed 's/^\s\+//' | sed 's/\s\+$//')"
SCORING_MODE_PROTEIN="false"
SCORING_MODE_PROTEIN_SIDECHAIN_REBUILT="false"
SCORING_MODE_GENERIC="false"
SCORING_MODE_GENERIC_SIDECHAIN_REBUILT="false"
SCORING_MODE_PROTEIN_GNN="false"
SCORING_MODE_PROTEIN_GNN_SIDECHAIN_REBUILT="false"
SCORING_MODE_PROTEIN_GLOBAL="false"
if [[ "$SCORING_RANKS" == *"_FIV_"* ]]
then
SCORING_MODE_PROTEIN="true"
fi
if [[ "$SCORING_RANKS" == *"_FIV_sr_"* ]]
then
SCORING_MODE_PROTEIN_SIDECHAIN_REBUILT="true"
fi
if [[ "$SCORING_RANKS" == *"_FIVb_"* ]]
then
SCORING_MODE_GENERIC="true"
fi
if [[ "$SCORING_RANKS" == *"_FIVb_sr_"* ]]
then
SCORING_MODE_GENERIC_SIDECHAIN_REBUILT="true"
fi
if [[ "$SCORING_RANKS" == *"_FIGNN_"* ]]
then
SCORING_MODE_PROTEIN_GNN="true"
fi
if [[ "$SCORING_RANKS" == *"_FIGNN_sr_"* ]]
then
SCORING_MODE_PROTEIN_GNN_SIDECHAIN_REBUILT="true"
fi
if [[ "$SCORING_RANKS" == *"_FGV_"* ]]
then
SCORING_MODE_PROTEIN_GLOBAL="true"
fi
if [ -z "$REFERENCE_STRUCTURE_FILE_FOR_COMPARISON" ] && [ "$SCORING_MODE_PROTEIN" != "true" ] && [ "$SCORING_MODE_PROTEIN_SIDECHAIN_REBUILT" != "true" ] && [ "$SCORING_MODE_GENERIC" != "true" ] && [ "$SCORING_MODE_GENERIC_SIDECHAIN_REBUILT" != "true" ] && [ "$SCORING_MODE_PROTEIN_GNN" != "true" ] && [ "$SCORING_MODE_PROTEIN_GNN_SIDECHAIN_REBUILT" != "true" ] && [ "$SCORING_MODE_PROTEIN_GLOBAL" != "true" ]
then
echo >&2 "Error: no scoring action enabled"
exit 1
fi
if [ -n "$WRITE_SCORES_PDB_FILE" ] && [ "$WRITE_SCORES_PDB_NUM" -gt "0" ]
then
if [ "$WRITE_SCORES_PDB_MODE" == "voromqa_dark" ]
then
if [ "$SCORING_MODE_PROTEIN_GNN" != "true" ]
then
echo >&2 "Error: mode '$WRITE_SCORES_PDB_MODE' for writing scores in PDB files is incompatible with requested scoring ranks"
exit 1
fi
fi
if [ "$WRITE_SCORES_PDB_MODE" == "voromqa_dark_and_gnn" ]
then
if [ "$SCORING_MODE_GENERIC" != "true" ] || [ "$SCORING_MODE_PROTEIN_GNN" != "true" ]
then
echo >&2 "Error: mode '$WRITE_SCORES_PDB_MODE' for writing scores in PDB files is incompatible with requested scoring ranks"
exit 1
fi
fi
fi
################################################################################
if [ "$CONDA_EARLY" == "true" ]
then
if [ -z "$CONDA_DEFAULT_ENV" ]
then
if [ -z "$CONDA_PATH" ]
then
echo >&2 "Error: not in conda environment, and the conda path is not provided"
exit 1
fi
if [ ! -s "${CONDA_PATH}/bin/activate" ]
then
echo >&2 "Error: no conda activation script '${CONDA_PATH}/bin/activate'"
exit 1
fi
source "${CONDA_PATH}/bin/activate"
fi
if [ -n "$CONDA_ENV" ]
then
if [ "$CONDA_DEFAULT_ENV" != "$CONDA_ENV" ]
then
conda activate "$CONDA_ENV"
fi
if [ "$CONDA_DEFAULT_ENV" != "$CONDA_ENV" ]
then
echo >&2 "Error: no '$CONDA_ENV' environment"
exit 1
fi
fi
CONDA_PATH=""
fi
################################################################################
if [ -z "$FTDMPDIR" ] || [ -n "$FTDMP_ROOT" ]
then
if [ -z "$FTDMP_ROOT" ]
then
export FTDMPDIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
else
export FTDMPDIR="$FTDMP_ROOT"
fi
export PATH="${FTDMPDIR}/core/voronota/expansion_js:${FTDMPDIR}/core/3D_Dock/progs:${FTDMPDIR}:${PATH}"
fi
################################################################################
JOB_NAME="$(cat ${TMPLDIR}/input_list | xargs cat | md5sum | awk '{print $1}')"
OUTPUT_PATH="${WORKDIR}/jobs/${JOB_NAME}"
mkdir -p "${OUTPUT_PATH}"
{
echo "ID"
cat "${TMPLDIR}/input_list" | xargs -L 1 basename
} \
> "${OUTPUT_PATH}/ids_to_process.txt"
CACHE_DIR="${WORKDIR}/cache"
PREV_SCORING_RESULTS_FILE="${OUTPUT_PATH}/ids_to_process.txt"
################################################################################
LOCAL_COLUMNS="false"
if [ -n "$WRITE_FULL_TABLE" ] && [ "$SCORING_MODE_PROTEIN_GNN" == "true" ]
then
LOCAL_COLUMNS="true"
fi
ftdmp-all-score \
--input-from-table "$PREV_SCORING_RESULTS_FILE" \
--structure-monomer1 "" \
--structure-monomer2 "" \
--structure-prefix "$INPUT_FILE_PATH_PREFIX" \
--structure-suffix "" \
--subselect-contacts "$INTERFACE_SUBSELECTION" \
--constraints-required "$CONSTRAINTS_REQUIRED" \
--constraints-banned "$CONSTRAINTS_BANNED" \
--constraint-clashes "$CONSTRAINT_CLASHES" \
--subselect-atoms-global "$SUBSELECT_ATOMS_FOR_GLOBAL" \
--reference "$REFERENCE_STRUCTURE_FILE_FOR_COMPARISON" \
--remap-cadscore "$REMAP_CADSCORE" \
--mode-protein "$SCORING_MODE_PROTEIN" \
--mode-protein-sr "$SCORING_MODE_PROTEIN_SIDECHAIN_REBUILT" \
--mode-generic "$SCORING_MODE_GENERIC" \
--mode-generic-sr "$SCORING_MODE_GENERIC_SIDECHAIN_REBUILT" \
--mode-protein-gnn "$SCORING_MODE_PROTEIN_GNN" \
--mode-protein-gnn-sr "$SCORING_MODE_PROTEIN_GNN_SIDECHAIN_REBUILT" \
--mode-protein-global "$SCORING_MODE_PROTEIN_GLOBAL" \
--external-scores "$EXTERNAL_SCORES_FILE" \
--conda-path "$CONDA_PATH" \
--conda-env "$CONDA_ENV" \
--score-symmetry "$SCORE_SYMMETRY" \
--local-columns "$LOCAL_COLUMNS" \
--keep-top "$KEEP_TOP_FAST" \
--keep-top-for-slow "$KEEP_TOP_SLOW" \
--clash-tour-tolerance "0.05" \
--parallel "$SCORING_PROCESSORS" \
--cache-dir "$CACHE_DIR" \
--sbatch "$SCORING_SBATCH" \
--output-names-prefix "raw_" \
--output-dir "$OUTPUT_PATH"
PREV_SCORING_RESULTS_FILE="${OUTPUT_PATH}/raw_scoring_results_with_ranks.txt"
if [ ! -s "$PREV_SCORING_RESULTS_FILE" ]
then
echo >&2 "Error: no raw scoring results"
exit 1
fi
################################################################################
if [ -n "$LIMIT_VOROMQA_LIGHT" ] && [ "$SCORING_MODE_PROTEIN_GLOBAL" == "true" ]
then
cat "$PREV_SCORING_RESULTS_FILE" \
| ftdmp-filter-table \
">=${LIMIT_VOROMQA_LIGHT}" "raw_FGV_full_light_score" \
> "${OUTPUT_PATH}/raw_scoring_results_with_ranks_limited_by_voromqa_light.txt"
PREV_SCORING_RESULTS_FILE="${OUTPUT_PATH}/raw_scoring_results_with_ranks_limited_by_voromqa_light.txt"
if [ ! -s "$PREV_SCORING_RESULTS_FILE" ]
then
echo >&2 "Error: no raw scoring results after limiting by VoroMQA-light score"
exit 1
fi
fi
################################################################################
if [ "$NUMBER_OF_INPUT_FILES" -gt "1" ]
then
ftdmp-all-jury \
--input-scoring-table "$PREV_SCORING_RESULTS_FILE" \
--structure-monomer1 "" \
--structure-monomer2 "" \
--structure-prefix "$INPUT_FILE_PATH_PREFIX" \
--structure-suffix "" \
--subselect-contacts "$INTERFACE_SUBSELECTION" \
--rank-names "$SCORING_RANKS" \
--ranks-top "$SCORING_RANKS_TOP" \
--remap-cadscore "$REMAP_CADSCORE" \
--crude-cadscore "$CRUDE_CADSCORE" \
--jury-slices "$SCORING_RANKS_JURY_SLICES" \
--jury-cluster "$SCORING_RANKS_JURY_CLUSTER" \
--jury-max-values "$SCORING_RANKS_JURY_MAX_VALUES" \
--redundancy-threshold "$REDUNDANCY_THRESHOLD" \
--parallel "$SCORING_PROCESSORS" \
--sbatch "$SCORING_SBATCH" \
--output-names-prefix "raw_"
PREV_SCORING_RESULTS_FILE="${OUTPUT_PATH}/raw_top_scoring_results_RJS.txt"
if [ -n "$WRITE_FULL_TABLE" ]
then
mkdir -p "$(dirname ${WRITE_FULL_TABLE})"
cat "$PREV_SCORING_RESULTS_FILE" \
> "$WRITE_FULL_TABLE"
fi
if [ ! -s "$PREV_SCORING_RESULTS_FILE" ]
then
echo >&2 "Error: no raw jury results"
exit 1
fi
if [ -n "$PLOT_JURY_SCORES" ]
then
ftdmp-plot-jury-scores \
--input-scoring-table "$PREV_SCORING_RESULTS_FILE" \
--prefix-for-jury-scores 'raw_RJS' \
--output "${OUTPUT_PATH}/raw_RJS_plot.png"
mkdir -p "$(dirname ${PLOT_JURY_SCORES})"
cp "${OUTPUT_PATH}/raw_RJS_plot.png" "$PLOT_JURY_SCORES"
fi
if [ "$PLOT_JURY_DIAGNOSTICS" == "true" ]
then
ftdmp-plot-jury-diagnostics \
--input-prefix "${OUTPUT_PATH}/raw_top_scoring_results_RJS_diagnostic_" \
--output-prefix "${OUTPUT_PATH}/raw_RJS_diagnostic_plot_"
fi
PREV_SCORING_RESULTS_FILE="${OUTPUT_PATH}/raw_top_scoring_results_RJS_nonredundant.txt"
if [ ! -s "$PREV_SCORING_RESULTS_FILE" ]
then
echo >&2 "Error: no raw non-redundant jury results"
exit 1
fi
fi
################################################################################
if [ -n "$WRITE_SCORES_PDB_FILE" ] && [ "$WRITE_SCORES_PDB_NUM" -gt "0" ]
then
cat "$PREV_SCORING_RESULTS_FILE" \
| ftdmp-extract-table-columns ID \
| tail -n +2 \
| head -n "$WRITE_SCORES_PDB_NUM" \
| awk '{print NR " " $1}' \
| while read -r RESULT_RANK ORIGINAL_FILE_BASENAME
do
PRETTY_RESULT_RANK="$(echo 00000000${RESULT_RANK} | sed 's/.*\(....\)$/\1/')"
ORIGINAL_INPUT_FILE="${INPUT_FILE_PATH_PREFIX}${ORIGINAL_FILE_BASENAME}"
OUTPUT_PDB_FILE="$(echo "${WRITE_SCORES_PDB_FILE}" | sed "s|-RANK-|${PRETTY_RESULT_RANK}|" | sed "s|-BASENAME-|${ORIGINAL_FILE_BASENAME}|")"
echo "${ORIGINAL_INPUT_FILE} ${OUTPUT_PDB_FILE}"
done \
> "$TMPLDIR/pdb_files_for_writing_cores"
if [ "$WRITE_SCORES_PDB_MODE" == "voromqa_dark" ] || [ "$WRITE_SCORES_PDB_MODE" == "voromqa_dark_and_gnn" ]
then
cat "$TMPLDIR/pdb_files_for_writing_cores" \
| awk '{print " --input " $1 " --output-dark-pdb " $2}' \
| xargs -L 1 -P "$SCORING_PROCESSORS" voronota-js-only-global-voromqa \
--cache-dir "$CACHE_DIR" \
--processors 1 \
> /dev/null
fi
if [ "$WRITE_SCORES_PDB_MODE" == "voromqa_dark_and_gnn" ]
then
cat "$TMPLDIR/pdb_files_for_writing_cores" \
| awk '{print " --input " $2 " --output-pdb-file " $2}' \
| xargs -L 1 -P "$SCORING_PROCESSORS" voronota-js-voroif-gnn \
--conda-path "$CONDA_PATH" \
--conda-env "$CONDA_ENV" \
--gnn "${FTDMPDIR}/core/voronota/expansion_js/voroif/gnn_packages/v1" \
--cache-dir "$CACHE_DIR" \
--processors 1 \
--output-pdb-mode "combine" \
> /dev/null
fi
fi
################################################################################
{
cat << 'EOF'
ID
raw_RJS_max
raw_FICS_iface_cadscore
raw_FICS_iface_site_based_cadscore
raw_FIGNN_sum_of_gnn_scores
raw_FIGNN_average_pcadscore
raw_FGV_full_dark_score
raw_FGV_full_light_score
raw_FIV_iface_energy
raw_FIVb_iface_energy
raw_FIVb_iface_clash_score
raw_FIVb_iface_area
raw_FIGNN_sr_sum_of_gnn_scores
raw_FIGNN_sr_average_pcadscore
raw_FIV_sr_iface_energy
raw_FIVb_sr_iface_energy
raw_FIVb_sr_iface_clash_score
raw_FIVb_sr_iface_area
raw_FIV_and_FGV_light_tour_rank
raw_FIV_and_FGV_dark_tour_rank
raw_RDDS_ordered_score
EOF
} \
| egrep -f <(head -n 1 "$PREV_SCORING_RESULTS_FILE" | tr ' ' '\n' | egrep . | awk -v dollar='$' '{print "^" $1 dollar}') \
> "$TMPLDIR/columns_to_output"
cat "$PREV_SCORING_RESULTS_FILE" \
| ftdmp-extract-table-columns $(cat $TMPLDIR/columns_to_output) \
> "$TMPLDIR/restricted_table"
{
head -n 1 "$TMPLDIR/restricted_table" \
| tr ' ' '\n' \
| sed 's/^raw_RJS_max$/jury_score/' \
| sed 's/^raw_FICS_iface_cadscore$/cadscore/' \
| sed 's/^raw_FICS_iface_site_based_cadscore$/site_cadscore/' \
| sed 's/^raw_FIGNN_sum_of_gnn_scores$/GNN_sum_score/' \
| sed 's/^raw_FIGNN_average_pcadscore$/GNN_pcadscore/' \
| sed 's/^raw_FGV_full_dark_score$/voromqa_dark/' \
| sed 's/^raw_FGV_full_light_score$/voromqa_light/' \
| sed 's/^raw_FIV_iface_energy$/voromqa_energy/' \
| sed 's/^raw_FIVb_iface_energy$/gen_voromqa_energy/' \
| sed 's/^raw_FIVb_iface_area$/area/' \
| sed 's/^raw_FIVb_iface_clash_score$/clash_score/' \
| sed 's/^raw_FIGNN_sr_sum_of_gnn_scores$/sr_GNN_sum_score/' \
| sed 's/^raw_FIGNN_sr_average_pcadscore$/sr_GNN_pcadscore/' \
| sed 's/^raw_FIV_sr_iface_energy$/sr_voromqa_energy/' \
| sed 's/^raw_FIVb_sr_iface_energy$/sr_gen_voromqa_energy/' \
| sed 's/^raw_FIVb_sr_iface_area$/sr_area/' \
| sed 's/^raw_FIVb_sr_iface_clash_score$/sr_clash_score/' \
| sed 's/^raw_FIV_and_FGV_light_tour_rank$/rank_2018/' \
| sed 's/^raw_FIV_and_FGV_dark_tour_rank$/rank_2020/' \
| sed 's/^raw_RDDS_ordered_score$/redundancy/' \
| tr '\n' ' ' \
| sed 's/\s*$/\n/'
tail -n +2 "$TMPLDIR/restricted_table" \
| awk '{printf("%s", $1); for(i=2;i<=NF;i++){printf(" %.3f", $i);} print("");}' \
| sed 's/\.0\+\s/ /g' \
| sed 's/\.0\+$//g'
} \
> "${OUTPUT_PATH}/results_for_humans.txt"
cat "${OUTPUT_PATH}/results_for_humans.txt"