forked from kliment-olechnovic/voronota
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvoronota-voromqa
executable file
·1920 lines (1745 loc) · 58.3 KB
/
voronota-voromqa
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
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
function print_help_and_exit
{
cat >&2 << EOF
'voronota-voromqa' script is an implementation of VoroMQA method using Voronota.
Basic options:
--input | -i string input structure file in PDB or mmCIF format
--input-filter-query string input atoms filtering query parameters
--output-atom-scores string output text file with atom scores
--output-atom-scores-pdb string output PDB file with atom scores as B-factors
--output-residue-scores string output text file with residue scores
--output-residue-scores-pdb string output PDB file with residue scores as B-factors
--output-residue-scores-plot string output PNG image file with residue scores plot, requires R
--help | -h flag to display help message and exit
Advanced options:
--cache-dir string path to cache directory
--smoothing-window number residue scores smoothing window size, default is 5
--atoms-query string atoms query parameters to define selection
--contacts-query string contacts query parameters to define selection
--output-selected-scores string output text file with selected atom scores
--reference-sequence string sequence file or string for residue renumbering
--output-sequence-alignment string output text file with sequence alignment
--print-header flag to print output header
--multiple-models flag to handle multiple models in PDB file
--score-inter-chain flag to output inter-chain interface scores
--list-all-options flag to display list of all command line options and exit
Standard output (one line):
{input file path} {global score} {number of residues} {number of atoms} [ {selection score} {number of selected atoms} ]
EOF
exit 1
}
function print_all_options_and_exit
{
cat << EOF
All options of 'voronota-voromqa' script, in alphabetical order:
--add-hydrogens string command to add hydrogens
--atoms-query string atoms query parameters to define selection
--cache-dir string path to cache directory
--contacts-query string contacts query parameters to define selection
--energy-input-potential string path to custom potential file
--energy-input-statistics string path to custom energy statistics file
--energy-mode string energy mode name
--help flag to display help message and exit
--highlight-selection-in-plot flag to highlight selection in plot
--input-filter-query string input atoms filtering query parameters
--input-is-list flag to treat input as a list of files
--input-is-structure flag to treat input as a PDB file
--input string input structure file in PDB format
--more-logging flag to enable more logging
--multiple-energy-modes string list of energy modes
--multiple-models flag to handle multiple models in PDB file
--mutation-goal string three-letter residue code
--mutation-query string atoms query parameters to define residues to mutate
--neglect-SAS flag to discard solvent-accessible surface
--no-multiple-energy-modes flag to not use multiple energy modes
--no-split-into-models flag to not split input into separate models
--no-use-slurm flag to not use Slurm
--options-for-calculating-contacts string custom options for calculating contacts
--output-atom-depth-values string output file with atom depth values
--output-atom-energies string output file with atom energy values
--output-atom-scores-pdb string output PDB file with atom scores as B-factors
--output-atom-scores string output text file with atom scores
--output-balls string output file with balls
--output-contacts-map-svg string output file with contact map image
--output-contacts string output file with contacts
--output-cutting-suggestions string output file with chain cutting suggestions
--output-directory-for-global-scores string output directory for global scores
--output-residue-scores-for-CAMEO string output file with output for CAMEO
--output-residue-scores-like-for-CASP string output file with output like for CASP
--output-residue-scores-pdb string output PDB file with residue scores as B-factors
--output-residue-scores-plot string output PNG image file with residue scores plot, requires R
--output-residue-scores string output text file with residue scores
--output-scores-for-CASP-log string output file with logs generated in CASP mode
--output-scores-for-CASP-pdb string output file with structure generated in CASP mode
--output-scores-for-CASP string output file with scores generated in CASP mode
--output-screenshot string output file with screenshot
--output-selected-scores string output text file with selected atom scores
--output-selected-scores-by-residue string output text file with selected scores summed by residue
--output-sequence-alignment string output text file with sequence alignment
--output-summary-for-potential string output file with statistics of contact
--print-clash-score-of-contacts-selection flag to print clash score of contacts selection
--print-energy-of-contacts-selection flag to print energy of contacts selection
--print-header flag to print output header
--print-horizontally flag to print output horizontally
--print-vertically flag to print output vertically
--probe-radius number probe radius for defining contacts
--processors number maximum number of processors to use
--rebuild-sidechains string command to rebuild side-chains
--reference-sequence string sequence file or string for residue renumbering
--reinterpret-SAS flag to interpret solvent as hydrophobic atoms
--sbatch-parameters string parameters for sbatch when using slurm
--score-inter-chain flag to output inter-chain interface scores
--screenshot-background string screenshot background color
--screenshot-height number screenshot image height
--screenshot-width number screenshot image width
--small-plot flag to generate smaller residue scores plot
--smoothing-window number residue scores smoothing window size, default is 5
--split-into-models string path to directory for storing extracted models
--strip-rotamers flag to remove sidechains
--surface-craving-atoms-energies-output string output text file with surface frustration results
--surface-craving-atoms-energies-pdb string output PDB file with surface frustration results
--surface-craving-atoms-output-pdb string output PDB file with atom scores as B-factors
--surface-craving-atoms-output string output text file with atom scores
--surface-craving-depth-value number depth for surface frustration calculation, default is 3
--surface-craving-residues-output-pdb string output PDB file with residue scores as B-factors
--surface-craving-residues-output string output text file with residue scores
--w-surface-craving-residues-output-pdb string output PDB file with residue scores as B-factors
--w-surface-craving-residues-output string output text file with residue scores
--tag-peripheral-contacts flag to tag peripheral contacts
--unteaching-dir string path to directory with potential-defining files
--use-slurm string path to directory to use for Slurm logs
EOF
exit 1
}
function substitute_ids_in_filename
{
SUBSTITUTE_BASENAME="$(basename "$1")"
SUBSTITUTE_ENERGY_MODE="$(basename "$2")"
SUBSTITUTE_TEMPLATE="$3"
echo "$SUBSTITUTE_TEMPLATE" \
| sed "s|-BASENAME-|$SUBSTITUTE_BASENAME|" \
| sed "s|-ENERGYMODE-|$SUBSTITUTE_ENERGY_MODE|"
}
readonly ZEROARG=$0
ALLARGS=("$@")
if [[ $ZEROARG == *"/"* ]]
then
cd "$(dirname ${ZEROARG})"
export PATH="$(pwd):${PATH}"
cd - &> /dev/null
fi
export LC_ALL=C
command -v voronota &> /dev/null || { echo >&2 "Error: 'voronota' executable not in binaries path"; exit 1; }
command -v voronota-resources &> /dev/null || { echo >&2 "Error: 'voronota-resources' executable not in binaries path"; exit 1; }
INFILE=""
REFERENCE_SEQUENCE=""
INPUT_FILTER_QUERY_PARAMETERS=""
OUTFILE_SEQUENCE_ALIGNMENT=""
OUTFILE_BALLS=""
OUTFILE_CONTACTS=""
OUTFILE_ATOM_ENERGIES=""
OUTFILE_ATOM_SCORES=""
OUTFILE_ATOM_SCORES_PDB=""
OUTFILE_RESIDUE_SCORES=""
OUTFILE_RESIDUE_SCORES_PDB=""
OUTFILE_ATOM_DEPTHS=""
OUTFILE_CAMEO_RESIDUE_SCORES=""
OUTFILE_CASPLIKE_RESIDUE_SCORES=""
OUTFILE_PLOT=""
OUTFILE_MAP=""
OUTFILE_SCREENSHOT=""
OUTFILE_SCORES_FOR_CASP=""
OUTFILE_SCORES_FOR_CASP_PDB=""
OUTFILE_SCORES_FOR_CASP_LOG=""
OUTFILE_CUTTING_SUGGESTIONS=""
OUTFILE_SUMMARY_FOR_POTENTIAL=""
OUTDIR_GLOBAL_SCORES=""
SMOOTHING_WINDOW="5"
ATOMS_QUERY_PARAMETERS=""
CONTACTS_QUERY_PARAMETERS=""
OUTFILE_SELECTED_ATOM_SCORES=""
OUTFILE_SELECTED_RESIDUE_SCORES=""
CACHE_DIRECTORY=""
MULTIPLE_MODELS_CHAINS_OPTION=""
UNTEACHING_DIRECTORY=""
REBUILD_SIDECHAINS_COMMAND=""
ADD_HYDROGENS_COMMAND=""
SCREENSHOT_WIDTH="500"
SCREENSHOT_HEIGHT="500"
SCREENSHOT_BACKGROUND="black"
PLOT_MODE="normal"
SURFACE_CRAVING_ATOMS_OUTPUT=""
SURFACE_CRAVING_ATOMS_OUTPUT_PDB=""
SURFACE_CRAVING_RESIDUES_OUTPUT=""
SURFACE_CRAVING_RESIDUES_OUTPUT_PDB=""
SURFACE_CRAVING_ATOMS_ENERGIES_OUTPUT=""
SURFACE_CRAVING_ATOMS_ENERGIES_PDB=""
SURFACE_CRAVING_DEPTH_VALUE="3"
WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT=""
WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT_PDB=""
ENERGY_MODE="voromqa_v1"
MULTIPLE_ENERGY_MODES=""
ENERGY_INPUT_POTENTIAL=""
ENERGY_INPUT_STATISTICS=""
PROBE_RADIUS="1.4"
MUTATION_QUERY=""
MUTATION_GOAL=""
OPTIONS_FOR_CALCULATING_CONTACTS=""
MAX_PROCESSORS="1"
USE_SLURM_DIR=""
SBATCH_PARAMETERS=""
SPLIT_INTO_MODELS_DIR=""
TAG_PERIPHERAL_CONTACTS=""
STRIP_ROTAMERS=false
NEGLECT_SAS=false
REINTERPRET_SAS=false
MORE_LOGGING=false
HIGHLIGHT_SELECTION_IN_PLOT=false
PRINT_ENERGY_OF_CONTACTS_SELECTION=false
PRINT_CLASH_SCORE_OF_CONTACTS_SELECTION=false
PRINT_GLOBAL_SCORES_HEADER=false
PRINT_GLOBAL_SCORES_VERTICALLY=false
TREAT_INPUT_AS_LIST_OF_FILES=false
SCORE_INTER_CHAIN=false
LIST_ALL_OPTIONS=false
HELP_MODE=false
while [[ $# > 0 ]]
do
OPTION="$1"
OPTARG="$2"
shift
case $OPTION in
-i|--input)
INFILE="$OPTARG"
shift
;;
--reference-sequence)
REFERENCE_SEQUENCE="$OPTARG"
shift
;;
--input-filter-query)
INPUT_FILTER_QUERY_PARAMETERS="$OPTARG"
shift
;;
--output-balls)
OUTFILE_BALLS="$OPTARG"
shift
;;
--output-contacts)
OUTFILE_CONTACTS="$OPTARG"
shift
;;
--output-sequence-alignment)
OUTFILE_SEQUENCE_ALIGNMENT="$OPTARG"
shift
;;
--output-atom-energies)
OUTFILE_ATOM_ENERGIES="$OPTARG"
shift
;;
--output-atom-scores)
OUTFILE_ATOM_SCORES="$OPTARG"
shift
;;
--output-atom-scores-pdb)
OUTFILE_ATOM_SCORES_PDB="$OPTARG"
shift
;;
--output-residue-scores)
OUTFILE_RESIDUE_SCORES="$OPTARG"
shift
;;
--output-residue-scores-pdb)
OUTFILE_RESIDUE_SCORES_PDB="$OPTARG"
shift
;;
--output-atom-depth-values)
OUTFILE_ATOM_DEPTHS="$OPTARG"
shift
;;
--output-residue-scores-for-CAMEO)
OUTFILE_CAMEO_RESIDUE_SCORES="$OPTARG"
shift
;;
--output-residue-scores-like-for-CASP)
OUTFILE_CASPLIKE_RESIDUE_SCORES="$OPTARG"
shift
;;
--output-residue-scores-plot)
OUTFILE_PLOT="$OPTARG"
shift
;;
--output-contacts-map-svg)
OUTFILE_MAP="$OPTARG"
shift
;;
--output-screenshot)
OUTFILE_SCREENSHOT="$OPTARG"
shift
;;
--output-scores-for-CASP)
OUTFILE_SCORES_FOR_CASP="$OPTARG"
shift
;;
--output-scores-for-CASP-pdb)
OUTFILE_SCORES_FOR_CASP_PDB="$OPTARG"
shift
;;
--output-scores-for-CASP-log)
OUTFILE_SCORES_FOR_CASP_LOG="$OPTARG"
shift
;;
--output-cutting-suggestions)
OUTFILE_CUTTING_SUGGESTIONS="$OPTARG"
shift
;;
--output-summary-for-potential)
OUTFILE_SUMMARY_FOR_POTENTIAL="$OPTARG"
shift
;;
--output-directory-for-global-scores)
OUTDIR_GLOBAL_SCORES="$OPTARG"
shift
;;
--smoothing-window)
SMOOTHING_WINDOW="$OPTARG"
shift
;;
--atoms-query)
ATOMS_QUERY_PARAMETERS="$OPTARG"
shift
;;
--contacts-query)
CONTACTS_QUERY_PARAMETERS="$OPTARG"
shift
;;
--output-selected-scores)
OUTFILE_SELECTED_ATOM_SCORES="$OPTARG"
shift
;;
--output-selected-scores-by-residue)
OUTFILE_SELECTED_RESIDUE_SCORES="$OPTARG"
shift
;;
--cache-dir)
CACHE_DIRECTORY="$OPTARG"
shift
;;
--unteaching-dir)
UNTEACHING_DIRECTORY="$OPTARG"
shift
;;
--rebuild-sidechains)
REBUILD_SIDECHAINS_COMMAND="$OPTARG"
shift
;;
--add-hydrogens)
ADD_HYDROGENS_COMMAND="$OPTARG"
shift
;;
--screenshot-width)
SCREENSHOT_WIDTH="$OPTARG"
shift
;;
--screenshot-height)
SCREENSHOT_HEIGHT="$OPTARG"
shift
;;
--screenshot-background)
SCREENSHOT_BACKGROUND="$OPTARG"
shift
;;
--surface-craving-atoms-output)
SURFACE_CRAVING_ATOMS_OUTPUT="$OPTARG"
shift
;;
--surface-craving-atoms-output-pdb)
SURFACE_CRAVING_ATOMS_OUTPUT_PDB="$OPTARG"
shift
;;
--surface-craving-residues-output)
SURFACE_CRAVING_RESIDUES_OUTPUT="$OPTARG"
shift
;;
--surface-craving-residues-output-pdb)
SURFACE_CRAVING_RESIDUES_OUTPUT_PDB="$OPTARG"
shift
;;
--surface-craving-atoms-energies-output)
SURFACE_CRAVING_ATOMS_ENERGIES_OUTPUT="$OPTARG"
shift
;;
--surface-craving-atoms-energies-pdb)
SURFACE_CRAVING_ATOMS_ENERGIES_PDB="$OPTARG"
shift
;;
--surface-craving-depth-value)
SURFACE_CRAVING_DEPTH_VALUE="$OPTARG"
shift
;;
--w-surface-craving-residues-output)
WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT="$OPTARG"
shift
;;
--w-surface-craving-residues-output-pdb)
WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT_PDB="$OPTARG"
shift
;;
--energy-mode)
ENERGY_MODE="$OPTARG"
shift
;;
--multiple-energy-modes)
MULTIPLE_ENERGY_MODES="$OPTARG"
shift
;;
--no-multiple-energy-modes)
MULTIPLE_ENERGY_MODES=""
;;
--energy-input-potential)
ENERGY_INPUT_POTENTIAL="$OPTARG"
shift
;;
--energy-input-statistics)
ENERGY_INPUT_STATISTICS="$OPTARG"
shift
;;
--probe-radius)
PROBE_RADIUS="$OPTARG"
shift
;;
--mutation-query)
MUTATION_QUERY="$OPTARG"
shift
;;
--mutation-goal)
MUTATION_GOAL="$OPTARG"
shift
;;
--options-for-calculating-contacts)
OPTIONS_FOR_CALCULATING_CONTACTS="$OPTARG"
shift
;;
--processors)
MAX_PROCESSORS="$OPTARG"
shift
;;
--use-slurm)
USE_SLURM_DIR="$OPTARG"
shift
;;
--no-use-slurm)
USE_SLURM_DIR=""
;;
--sbatch-parameters)
SBATCH_PARAMETERS="$OPTARG"
shift
;;
--split-into-models)
SPLIT_INTO_MODELS_DIR="$OPTARG"
shift
;;
--no-split-into-models)
SPLIT_INTO_MODELS_DIR=""
;;
--tag-peripheral-contacts)
TAG_PERIPHERAL_CONTACTS="--tag-peripherial"
;;
--multiple-models)
MULTIPLE_MODELS_CHAINS_OPTION="--multimodel-chains"
;;
--small-plot)
PLOT_MODE="small"
;;
--strip-rotamers)
STRIP_ROTAMERS=true
;;
--neglect-SAS)
NEGLECT_SAS=true
;;
--reinterpret-SAS)
REINTERPRET_SAS=true
;;
--more-logging)
MORE_LOGGING=true
;;
--highlight-selection-in-plot)
HIGHLIGHT_SELECTION_IN_PLOT=true
;;
--print-energy-of-contacts-selection)
PRINT_ENERGY_OF_CONTACTS_SELECTION=true
;;
--print-clash-score-of-contacts-selection)
PRINT_CLASH_SCORE_OF_CONTACTS_SELECTION=true
;;
--print-header)
PRINT_GLOBAL_SCORES_HEADER=true
;;
--print-vertically)
PRINT_GLOBAL_SCORES_VERTICALLY=true
;;
--print-horizontally)
PRINT_GLOBAL_SCORES_VERTICALLY=false
;;
--input-is-list)
TREAT_INPUT_AS_LIST_OF_FILES=true
;;
--input-is-structure)
TREAT_INPUT_AS_LIST_OF_FILES=false
;;
--score-inter-chain)
SCORE_INTER_CHAIN=true
;;
--list-all-options)
LIST_ALL_OPTIONS=true
;;
-h|--help)
HELP_MODE=true
;;
*)
echo >&2 "Error: invalid command line option '$OPTION'"
exit 1
;;
esac
done
if $HELP_MODE
then
print_help_and_exit
fi
if $LIST_ALL_OPTIONS
then
print_all_options_and_exit
fi
if [ -z "$INFILE" ] && [ ! -t 0 ]
then
INFILE="-"
fi
if [ -z "$INFILE" ]
then
echo >&2 "Error: no input"
exit 1
fi
if [ "$ENERGY_MODE" != "voromqa_v1" ] && [ "$ENERGY_MODE" != "voromqa_v2b" ]
then
echo >&2 "Error: unsupported energy mode '$ENERGY_MODE'"
exit 1
fi
if [ -z "$ADD_HYDROGENS_COMMAND" ]
then
if [ "$ENERGY_MODE" == "voromqa_v2b" ] || [ "$ENERGY_MODE" == "voromqa_v3b" ]
then
ADD_HYDROGENS_COMMAND="reduce"
fi
fi
if [ -z "$TAG_PERIPHERAL_CONTACTS" ]
then
if [ "$ENERGY_MODE" == "voromqa_v3a" ] || [ "$ENERGY_MODE" == "voromqa_v3b" ] || [ "$ENERGY_MODE" == "voromqa_v5" ]
then
TAG_PERIPHERAL_CONTACTS="--tag-peripherial"
fi
fi
if [ -z "$PROBE_RADIUS" ]
then
if [ "$ENERGY_MODE" == "voromqa_v4" ] || [ "$ENERGY_MODE" == "voromqa_v5" ]
then
PROBE_RADIUS="3.5"
fi
fi
if [ "$STRIP_ROTAMERS" != "true" ]
then
if [ "$ENERGY_MODE" == "voromqa_v4" ] || [ "$ENERGY_MODE" == "voromqa_v5" ]
then
STRIP_ROTAMERS="true"
fi
fi
if [ -n "$ENERGY_INPUT_POTENTIAL" ] && [ ! -s "$ENERGY_INPUT_POTENTIAL" ]
then
echo >&2 "Error: no file '$ENERGY_INPUT_POTENTIAL'"
exit 1
fi
if [ -n "$ENERGY_INPUT_STATISTICS" ] && [ ! -s "$ENERGY_INPUT_STATISTICS" ]
then
echo >&2 "Error: no file '$ENERGY_INPUT_STATISTICS'"
exit 1
fi
if [ -n "$OUTFILE_CAMEO_RESIDUE_SCORES" ] && [ -n "$MULTIPLE_MODELS_CHAINS_OPTION" ]
then
echo >&2 "Error: '--output-residue-scores-for-CAMEO' and '--multiple-models' cannot be used together"
exit 1
fi
if [ -n "$REBUILD_SIDECHAINS_COMMAND" ] && [ -n "$MULTIPLE_MODELS_CHAINS_OPTION" ]
then
echo >&2 "Error: '--rebuild-side-chains' and '--multiple-models' cannot be used together"
exit 1
fi
if [ -n "$REBUILD_SIDECHAINS_COMMAND" ] && [ -n "$OUTFILE_CAMEO_RESIDUE_SCORES" ]
then
echo >&2 "Error: '--rebuild-sidechains' and '--output-residue-scores-for-CAMEO' cannot be used together"
exit 1
fi
if [ -z "$REFERENCE_SEQUENCE" ] && [ -n "$OUTFILE_SEQUENCE_ALIGNMENT" ]
then
echo >&2 "Error: '--output-sequence-alignment' cannot be used without '--reference-sequence'"
exit 1
fi
if [ -z "$REFERENCE_SEQUENCE" ] && [ -n "$OUTFILE_SCORES_FOR_CASP" ]
then
echo >&2 "Error: '--output-scores-for-CASP' cannot be used without '--reference-sequence'"
exit 1
fi
if [ -z "$OUTFILE_SCORES_FOR_CASP" ] && [ -n "$OUTFILE_SCORES_FOR_CASP_PDB" ]
then
echo >&2 "Error: '--output-scores-for-CASP-pdb' cannot be used without '--output-scores-for-CASP'"
exit 1
fi
if [ -z "$OUTFILE_SCORES_FOR_CASP" ] && [ -n "$OUTFILE_SCORES_FOR_CASP_LOG" ]
then
echo >&2 "Error: '--output-scores-for-CASP-log' cannot be used without '--output-scores-for-CASP'"
exit 1
fi
if [ -n "$MUTATION_QUERY" ] && [ -z "$REBUILD_SIDECHAINS_COMMAND" ] && [ "$STRIP_ROTAMERS" != "true" ]
then
echo >&2 "Error: '--mutation-query' cannot be used without '--rebuild-sidechains'"
exit 1
fi
if [ -n "$MUTATION_QUERY" ] && [ -z "$MUTATION_GOAL" ]
then
echo >&2 "Error: '--mutation-query' cannot be used without '--mutation-goal'"
exit 1
fi
if [ -n "$MUTATION_GOAL" ] && [ -z "$MUTATION_QUERY" ]
then
echo >&2 "Error: '--mutation-goal' cannot be used without '--mutation-query'"
exit 1
fi
if $SCORE_INTER_CHAIN
then
CONTACTS_QUERY_PARAMETERS="$CONTACTS_QUERY_PARAMETERS --no-same-chain --no-solvent"
PRINT_ENERGY_OF_CONTACTS_SELECTION=true
PRINT_CLASH_SCORE_OF_CONTACTS_SELECTION=true
PRINT_GLOBAL_SCORES_HEADER=true
fi
MD5SUM_COMMAND="md5sum"
if command -v md5sum &> /dev/null
then
MD5SUM_COMMAND="md5sum"
else
MD5SUM_COMMAND="md5"
fi
command -v $MD5SUM_COMMAND &> /dev/null || { echo >&2 "Error: 'md5sum' or 'md5' executable not in binaries path"; exit 1; }
if [ -n "$OUTFILE_PLOT" ]
then
command -v R &> /dev/null || { echo >&2 "Error: 'R' command, needed for plotting, is not available"; exit 1; }
fi
if [ -n "$OUTFILE_SCREENSHOT" ]
then
command -v pymol &> /dev/null || { echo >&2 "Error: 'pymol' command, needed for making screenshots, is not available"; exit 1; }
fi
if [ -n "$REBUILD_SIDECHAINS_COMMAND" ]
then
command -v $REBUILD_SIDECHAINS_COMMAND &> /dev/null || { echo >&2 "Error: '$REBUILD_SIDECHAINS_COMMAND' command, requested for rebuilding side-chains, is not available"; exit 1; }
fi
if [ -n "$ADD_HYDROGENS_COMMAND" ]
then
command -v $ADD_HYDROGENS_COMMAND &> /dev/null || { echo >&2 "Error: '$ADD_HYDROGENS_COMMAND' command, requested for adding hydrogens, is not available"; exit 1; }
fi
if [ -n "$USE_SLURM_DIR" ]
then
command -v sbatch &> /dev/null || { echo >&2 "Error: 'sbatch' command, needed for using Slurm, is not available"; exit 1; }
fi
readonly TMPLDIR=$(mktemp -d)
trap "rm -r $TMPLDIR" EXIT
voronota-resources radii > "$TMPLDIR/radii"
if [ ! -s "$TMPLDIR/radii" ]
then
echo >&2 "Error: failed to get the predefined atomic radii"
exit 1
fi
if [ -n "$REFERENCE_SEQUENCE" ] && [ ! -s "$REFERENCE_SEQUENCE" ]
then
if [ "$REFERENCE_SEQUENCE" == "$(echo $REFERENCE_SEQUENCE | tr -dc '[:alpha:]')" ]
then
echo "$REFERENCE_SEQUENCE" > "$TMPLDIR/reference_sequence_file"
REFERENCE_SEQUENCE="$TMPLDIR/reference_sequence_file"
else
echo >&2 "Error: invalid reference sequence"
exit 1
fi
fi
INFILE_CONTENTS=$INFILE
if [[ "$INFILE" == *"://"* ]]
then
INFILE_CONTENTS=$TMPLDIR/downloaded_input_file
curl -s "$INFILE" > $INFILE_CONTENTS
fi
if [ "$INFILE" == "-" ]
then
INFILE_CONTENTS=$TMPLDIR/downloaded_input_file
cat > $INFILE_CONTENTS
fi
if [ ! -s "$INFILE_CONTENTS" ]
then
echo >&2 "Error: input file does not exist or is empty"
exit 1
fi
INFILE_CONTENTS_EXTRACTED=$INFILE_CONTENTS
if [[ "$INFILE" == *".gz" ]]
then
INFILE_CONTENTS_EXTRACTED=$TMPLDIR/extracted_input_file
zcat $INFILE_CONTENTS > $INFILE_CONTENTS_EXTRACTED
if [ ! -s "$INFILE_CONTENTS_EXTRACTED" ]
then
echo >&2 "Error: could not extract gzipped file"
exit 1
fi
fi
if $TREAT_INPUT_AS_LIST_OF_FILES
then
mkdir -p "$TMPLDIR/children_global_scores"
if [ -n "$USE_SLURM_DIR" ]
then
mkdir -p "$USE_SLURM_DIR"
cat "$INFILE_CONTENTS_EXTRACTED" \
| sort \
| uniq \
| xargs -L 1 sbatch -o "$USE_SLURM_DIR/slurmjob-%j.out" -e "$USE_SLURM_DIR/slurmjob-%j.err" $SBATCH_PARAMETERS \
"$ZEROARG" "${ALLARGS[@]}" \
--print-header \
--print-horizontally \
--input-is-structure \
--input \
| egrep '^Submitted batch job ' \
| awk '{print $4}' \
> "$TMPLDIR/slurm_job_ids"
if [ ! -s "$TMPLDIR/slurm_job_ids" ]
then
echo >&2 "Error: no Slurm jobs submitted"
exit 1
fi
REMAINING_SLURM_JOBS="$(squeue | grep -f "$TMPLDIR/slurm_job_ids" | wc -l)"
while [ "$REMAINING_SLURM_JOBS" -gt "0" ]
do
sleep 5
REMAINING_SLURM_JOBS="$(squeue | grep -f "$TMPLDIR/slurm_job_ids" | wc -l)"
done
cat "$TMPLDIR/slurm_job_ids" | while read SLURM_JOB_ID
do
cat "$USE_SLURM_DIR/slurmjob-${SLURM_JOB_ID}.out" > "$TMPLDIR/children_global_scores/result_${SLURM_JOB_ID}"
done
else
cat "$INFILE_CONTENTS_EXTRACTED" \
| sort \
| uniq \
| xargs -L 1 -P "$MAX_PROCESSORS" "$ZEROARG" "${ALLARGS[@]}" \
--print-header \
--print-horizontally \
--output-directory-for-global-scores "$TMPLDIR/children_global_scores" \
--input-is-structure \
--input \
> /dev/null
fi
find "$TMPLDIR/children_global_scores" -type f -not -empty > "$TMPLDIR/global_score_files"
MAX_NUMBER_OF_FIELDS="$(cat "$TMPLDIR/global_score_files" | xargs -L 1 awk '{print NF}' | awk '{if(MAX=="" || ($1+0)>MAX){MAX=$1}} END {print MAX}')"
{
cat "$TMPLDIR/global_score_files" | while read GSFILE
do
if [ "$(cat "$GSFILE" | tail -1 | awk '{print NF}')" -eq "$MAX_NUMBER_OF_FIELDS" ]
then
echo "$GSFILE"
fi
done
} \
| xargs -L 1 cat \
| awk '{if(NR==1 || $1!="input") print $0}' \
> "$TMPLDIR/unsorted_table"
cat "$TMPLDIR/unsorted_table" | head -1
cat "$TMPLDIR/unsorted_table" | tail -n +2 | sort
exit 0
fi
if [ -n "$SPLIT_INTO_MODELS_DIR" ]
then
mkdir -p "$SPLIT_INTO_MODELS_DIR"
cat "$INFILE_CONTENTS_EXTRACTED" \
| voronota x-split-atoms-file --prefix "${SPLIT_INTO_MODELS_DIR}/$(basename $INFILE)__" --postfix '.pdb' \
| "$ZEROARG" "${ALLARGS[@]}" --input - --input-is-list --no-split-into-models \
| \
{
if [ -n "$OUTDIR_GLOBAL_SCORES" ]
then
mkdir -p "$OUTDIR_GLOBAL_SCORES"
cat | tee "$(mktemp "$OUTDIR_GLOBAL_SCORES/vgs.XXXXXXXXXX")"
else
cat
fi
}
exit 0
fi
if [ -n "$MULTIPLE_ENERGY_MODES" ]
then
echo "$MULTIPLE_ENERGY_MODES" \
| sed 's/\s\+/\n/g' \
| sed 's/,\+/\n/g' \
| egrep '\S' \
| sort \
| uniq \
| xargs -L 1 "$ZEROARG" "${ALLARGS[@]}" \
--print-header \
--print-vertically \
--no-multiple-energy-modes \
--output-directory-for-global-scores "" \
--input "$INFILE_CONTENTS_EXTRACTED" \
--energy-mode \
| egrep -v '^input' \
| \
{
echo "input $INFILE"
cat
} \
| \
{
if $PRINT_GLOBAL_SCORES_VERTICALLY
then
cat
else
cat > "$TMPLDIR/multiple_global_scores"
cat "$TMPLDIR/multiple_global_scores" | awk '{print $1}' | tr '\n' ' ' | sed 's/\s$/\n/'
cat "$TMPLDIR/multiple_global_scores" | awk '{print $2}' | tr '\n' ' ' | sed 's/\s$/\n/'
fi
} \
| \
{
if [ -n "$OUTDIR_GLOBAL_SCORES" ]
then
mkdir -p "$OUTDIR_GLOBAL_SCORES"
cat | tee "$(mktemp "$OUTDIR_GLOBAL_SCORES/vgs.XXXXXXXXXX")"
else
cat
fi
}
exit 0
fi
REFERENCE_SEQUENCE="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$REFERENCE_SEQUENCE")"
OUTFILE_SEQUENCE_ALIGNMENT="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SEQUENCE_ALIGNMENT")"
OUTFILE_BALLS="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_BALLS")"
OUTFILE_CONTACTS="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_CONTACTS")"
OUTFILE_ATOM_ENERGIES="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_ATOM_ENERGIES")"
OUTFILE_ATOM_SCORES="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_ATOM_SCORES")"
OUTFILE_ATOM_SCORES_PDB="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_ATOM_SCORES_PDB")"
OUTFILE_RESIDUE_SCORES="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_RESIDUE_SCORES")"
OUTFILE_RESIDUE_SCORES_PDB="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_RESIDUE_SCORES_PDB")"
OUTFILE_ATOM_DEPTHS="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_ATOM_DEPTHS")"
OUTFILE_CAMEO_RESIDUE_SCORES="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_CAMEO_RESIDUE_SCORES")"
OUTFILE_CASPLIKE_RESIDUE_SCORES="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_CASPLIKE_RESIDUE_SCORES")"
OUTFILE_PLOT="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_PLOT")"
OUTFILE_MAP="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_MAP")"
OUTFILE_SCREENSHOT="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SCREENSHOT")"
OUTFILE_SCORES_FOR_CASP="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SCORES_FOR_CASP")"
OUTFILE_SCORES_FOR_CASP_PDB="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SCORES_FOR_CASP_PDB")"
OUTFILE_SCORES_FOR_CASP_LOG="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SCORES_FOR_CASP_LOG")"
OUTFILE_CUTTING_SUGGESTIONS="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_CUTTING_SUGGESTIONS")"
OUTFILE_SUMMARY_FOR_POTENTIAL="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SUMMARY_FOR_POTENTIAL")"
OUTFILE_SELECTED_ATOM_SCORES="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SELECTED_ATOM_SCORES")"
OUTFILE_SELECTED_RESIDUE_SCORES="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$OUTFILE_SELECTED_RESIDUE_SCORES")"
SURFACE_CRAVING_ATOMS_OUTPUT="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$SURFACE_CRAVING_ATOMS_OUTPUT")"
SURFACE_CRAVING_ATOMS_OUTPUT_PDB="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$SURFACE_CRAVING_ATOMS_OUTPUT_PDB")"
SURFACE_CRAVING_RESIDUES_OUTPUT="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$SURFACE_CRAVING_RESIDUES_OUTPUT")"
SURFACE_CRAVING_RESIDUES_OUTPUT_PDB="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$SURFACE_CRAVING_RESIDUES_OUTPUT_PDB")"
SURFACE_CRAVING_ATOMS_ENERGIES_OUTPUT="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$SURFACE_CRAVING_ATOMS_ENERGIES_OUTPUT")"
SURFACE_CRAVING_ATOMS_ENERGIES_PDB="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$SURFACE_CRAVING_ATOMS_ENERGIES_PDB")"
WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT")"
WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT_PDB="$(substitute_ids_in_filename "$INFILE" "$ENERGY_MODE" "$WEIGHTED_SURFACE_CRAVING_RESIDUES_OUTPUT_PDB")"
cat $INFILE_CONTENTS_EXTRACTED \
| voronota get-balls-from-atoms-file \
--input-format detect \
--annotated $MULTIPLE_MODELS_CHAINS_OPTION \
--radii-file $TMPLDIR/radii \
--include-heteroatoms \
| voronota query-balls \
--match 'R<LEU,ALA,GLY,VAL,GLU,SER,LYS,ILE,ASP,THR,ARG,PRO,ASN,PHE,GLN,TYR,HIS,MET,TRP,CYS,MSE>' \
| voronota query-balls \
--drop-adjuncts \
--drop-altloc-indicators \
| \
{
if [ -n "$INPUT_FILTER_QUERY_PARAMETERS" ]
then
voronota query-balls $INPUT_FILTER_QUERY_PARAMETERS
else
cat
fi
} \
| \
{
if [ -s "$REFERENCE_SEQUENCE" ]
then
voronota query-balls \
--set-ref-seq-num-adjunct "$REFERENCE_SEQUENCE" \
--ref-seq-alignment $TMPLDIR/sequence_alignment \
| voronota query-balls \
--renumber-from-adjunct refseq \
| voronota query-balls \
--drop-adjuncts
else
cat
fi
} \
| \
{
if [ -n "$MUTATION_QUERY" ]
then
voronota query-balls $MUTATION_QUERY \
--set-tags mutating \
| sed 's/\(.*R<\)\(...\)\(.*mutating.*\)/\1XXX\3/' \
| sed "s/R<XXX>/R<$MUTATION_GOAL>/" \
| sed 's/;mutating;/;/' \
| sed 's/;mutating//' \
| sed 's/mutating;//' \
| sed 's/mutating/./'
else
cat
fi
} \
| \
{
if [ -n "$REBUILD_SIDECHAINS_COMMAND" ]
then
voronota query-balls \
--match 'A<CA,C,N,O,OXT>' \
| voronota write-balls-to-atoms-file \
--pdb-output $TMPLDIR/atoms_stripped.pdb \
> /dev/null
$REBUILD_SIDECHAINS_COMMAND -h \
-i $TMPLDIR/atoms_stripped.pdb \
-o $TMPLDIR/atoms_rebuilt.pdb \
> /dev/null
cat $TMPLDIR/atoms_rebuilt.pdb \
| voronota get-balls-from-atoms-file \
--annotated \
--radii-file $TMPLDIR/radii \
| voronota query-balls \
--drop-adjuncts
else
cat