-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdb_redo.csh
executable file
·10892 lines (9720 loc) · 441 KB
/
pdb_redo.csh
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/tcsh -f
# pdb_redo.csh: a general method for optimising macromolecular crystallographic structures.
#
# PDB_REDO installation directory. EDIT THIS!
setenv BASE /zata
# This script was created by Robbie P. Joosten, Bart van Beusekom, and Wouter Touw
# Correspondence to r.joosten@nki.nl or robbie_joosten@hotmail.com
#
# Reference: If you publish results (directly or indirectly) obtained by using this protocol, please refer to (any of)
# these publications:
# 1) Robbie P. Joosten, Gert Vriend: "PDB improvement starts with data deposition" Science, 317, p. 195-196 (2007)
# 2) Robbie P. Joosten, Thomas Womack, Gert Vriend and Gerard Bricogne: "Re-refinement fromdeposited X-ray data can
# deliver improved models for most PDB entries" Acta Cryst. D65, p. 176-185 (2009)
# 3) Robbie P. Joosten, Jean Salzemann, Vincent Bloch, Heinz Stockinger, Ann-Charlott Berglund, Christophe Blanchet, Erik
# Bongcam-Rudloff, Christophe Combet, Ana L. Da Costa, Gilbert Deleage, Matteo Diarena, Roberto Fabbretti, Geraldine
# Fettahi, Volker Flegel, Andreas Gisel, Vinod Kasam, Timo Kervinen, Eija Korpelainen, Kimmo Mattila, Marco Pagni,
# Matthieu Reichstadt, Vincent Breton, Ian J. Tickle, Gert Vriend: "PDB_REDO: automated re-refinement of X-ray
# structure models in the PDB" J. Appl. Cryst., 42, p. 376-384 (2009)
# 4) Robbie P. Joosten, Tim A.H. te Beek, Elmar Krieger, Maarten Hekkelman, Rob W.W. Hooft, Reinhard Schneider, Chris
# Sander, Gert Vriend: "A series of PDB related databases for everyday needs" Nucl. Acids Res., 39, p. D411-D419 (2011)
# 5) Robbie P. Joosten, Krista Joosten, Serge X. Cohen, Gert Vriend, Anastassis Perrakis: "Automatic rebuilding and
# optimisation of crystallographic structures in the Protein Data Bank" Bioinformatics, 27, p. 3392-3398 (2011)
# 6) Robbie P. Joosten, Krista Joosten, Garib N. Murshudov, Anastass Perrakis: "PDB_REDO: constructive validation, more
# than just looking for errors" Acta Cryst. D68, p. 484-496 (2012)
#
# Usage notice:
if ($#argv == 0 ) then
echo "How to use PDB-REDO:"
echo " "
echo "Optimising your structure model (locally):"
echo "'$0 --local --xyzin=a_coordinate_file --hklin=an_mmCIF_file (or --mtzin=an_mtz_file) (--tlsin=tls_file) (--homin=pdb_file) (--restin=cif_restraint_file) (--extin=external_restraints) (--seqin=fasta_sequence_file) --dirout=place_for_output (--flags) (--params=parameter_JSON_file)'"
echo " "
echo "Optimising your structure model (as a PDB-REDO webserver):"
echo "'$0 --server --xyzin=a_coordinate_file --hklin=an_mmCIF_file (or --mtzin=an_mtz_file) (--tlsin=tls_file) (--homin=pdb_file) (--restin=cif_restraint_file) (--extin=external_restraints) (--seqin=fasta_sequence_file) --dirout=place_for_output (--flags) (--params=parameter_JSON_file)'"
echo " "
echo "Optimising an entry from the Protein Data Bank (PDB):"
echo "'$0 [PDBid] (--download) (--tlsin=tls_file) (--homin=pdb_file) (--restin=cif_restraint_file) (--extin=external_restraints) (--dirout=place_for_output) (--flags) (--params=parameter_JSON_file)'"
echo " "
echo "For fragment screens where data from many jobs must be consolidated (job exits after rebuilding step):"
echo "'$0 --local --screen --xyzin=a_coordinate_file --hklin=an_mmCIF_file (or --mtzin=an_mtz_file) --fitlig=RES (--tlsin=tls_file) (--homin=pdb_file) (--restin=cif_restraint_file) (--extin=external_restraints) (--seqin=fasta_sequence_file) --dirout=place_for_output (--flags) (--params=parameter_JSON_file)'"
echo " "
echo "Jobs can be restarted with:"
echo "'$0 --local --restart_from=temporary_directory_for_job (--fit_mapin=a_map_for_fitting)'"
echo " "
echo "Please note:"
echo "-The --xyzin option takes input in PDB or mmCIF format. Validation of mmCIF format is strict."
echo "-The --restin option takes a single restraint file for Refmac in mmCIF format."
echo " It overrides all the automatic restraint generation."
echo "-The --extin option takes a single external restraint file in Refmac format."
echo " The external restraints are added to those generated within PDB-REDO."
echo "-The --seqin option takes a sequence file in fasta format."
echo " The sequence is cross checked with the (ATOM and SEQRES) sequence in the coordinate file."
echo "-The --tlsin option takes an extra TLS group definition in Refmac format."
echo " You can give the --tlsin option multiple times to test more TLS group definitions."
echo "-The --fitlig=RES option triggers the fitting of the compound 'RES' after rebuilding."
echo " You can use the --fitlig= option multiple times to search for multiple compounds."
echo "-The --fit_mapin option specifies a map in CCP4 format for ligand fitting."
echo " This option is only sensible when restarting in screen mode."
echo "-You can add a comment to the output: --comment='This is a comment'"
echo "-The --download flag lets the required data from be downloaded from PDBe. Without"
echo " this flag the required data is taken from a local copy of the PDB."
echo "-The --params option takes a JSON file with the basic debug flags below. The key is"
echo " the flag without the '--' and the value is 1 or true to activate it. The tighter"
echo " and looser keys take positive integers. Higher numbers increase the tightness (or"
echo " looseness) of the restraints. The fitlig key takes an array of residue names and"
echo " the maxres key takes a float. Example:"
echo ' {"legacy": true, "fitlig": ["SO4", "GOL"], "crossval": false, "tighter":2}'
echo " "
echo "These basic debug flags are available:"
echo "--nohyd : do not add hydrogens (in riding postions) during refinement"
echo "--legacy : for legacy PDB entries. R-factor is not checked and the number of "
echo " refinement cycles is increased (a lot)"
echo "--notls : no TLS refinement is performed"
echo "--notlsupdate : use TLS, but do not update the tensors in the final refinement"
echo "--noncs : no NCS restraints are applied"
echo "--nojelly : switch off jelly body refinement"
echo "--notwin : no detwinning is performed"
echo "--newmodel : always take an updated model from the re-refinement for the rebuilding"
echo " steps. Only use this option when all else fails"
echo "--tighter : try tighter restraints than usual (use '--tighter --tighter' for even"
echo " tighter restraints)"
echo "--looser : try looser restraints than usual (use '--looser --looser' for even"
echo " looser restraints)"
echo "--noloops : do not try to complete loops"
echo "--nofixdmc : do not add missing backbone atoms"
echo "--nopepflip : no peptide flips are performed"
echo "--noscbuild : side chains will not be rebuilt"
echo "--nocentrifuge: waters with poor density will not be deleted"
echo "--norebuild : all rebuilding steps are skipped"
echo "--nosugarbuild: no (re)building of carbohydrates"
echo "--noanomalous : ignore all anomalous data if Fmean or Imean are available"
echo "--maxres=VAL : cut the resolution to VAL Angstrom"
echo "--fewrefs : deals with very small data sets by switching off R-free set sanity checks"
echo "--crossval : performs (very lengthy) k-fold cross validation on the final results"
echo "--intens : force the use of the intensities from the reflection file"
echo "--noocc : do not refine occupancies"
echo "--notruncate : do not use truncate to convert intensities to amplitudes"
echo "--nosigma : do not use sigF or sigI for scaling etc."
echo "--anysigma : use sigF and sigI regardless of their perceived quality"
echo "--nometalrest : do not generate special metal restraints"
echo "--nohomology : do not use homology-based restraints"
echo "--homology : force homology-based restraints"
echo "--hbondrest : use hydrogen bond restraints"
echo "--nonucrest : do not use nucleic acid restraints"
echo "--paired : force paired refinement"
echo "--isotropic : force isotropic B-factors if there are fewer than 30 reflections/atom"
# Hidden echo "--nqa_isotropic : force isotropic B-factors no matter what"
echo "--anisotropic : force anisotropic B-factors if there are more than 13 reflections/atom"
echo " and the resolution is better than 1.95A"
echo "--nofoldit : do not consider FoldIt solutions as starting model"
echo " "
echo "Debug flags only for working on local PDB entries:"
echo "--nopdb : any existing PDB file in the working directory is not replaced"
echo "--frompdb : start from the PDB databank in PDB format"
echo "--nosf : any existing reflection file in the working directory is not replaced"
echo "--mtzdb : the structure factor files are stored in MTZ format"
echo " "
echo "Debug flags for performance:"
echo "--nproc=value : the maximum number of CPU cores you want to use (the default is 1);"
echo " values greater than 7 or the actual number of CPU cores on your"
echo " system are not recommended"
echo "--lowmem : reduce memory consumption for massive models that otherwise stop Refmacat"
echo " "
echo "Citing PDB-REDO:"
echo "-Robbie P. Joosten, Krista Joosten, Serge X. Cohen, Gert Vriend, Anastassis Perrakis: "
echo " Automatic rebuilding and optimization of crystallographic structures in the Protein Data Bank"
echo " Bioinformatics, 27, p. 3392-3398 (2011)"
echo "-Robbie P. Joosten, Krista Joosten, Garib N. Murshudov, Anastassis Perrakis:"
echo " PDB_REDO: constructive validation, more than just looking for errors"
echo " Acta Cryst. D68, p. 484-496 (2012)"
exit(0)
endif
#
# Required software:
# - PDB-REDO Download it from http://pdb-redo.eu
# - CCP4 package Download it from http://www.ccp4.ac.uk
#
# Optional but highly recommended software
# - BlastP apt install ncbi-blast+
# Needed for homology-based functionality
# - YASARA Download it from http://www.yasara.org
# You need at least YASARA model for pictures describing atomic shifts and TLS grouping and
# YASARA dynamics for ligand validation
# - x3dna-dssr Needed for nucleic acid restraints and validation
# - DNATCO Validation of nucleic acid models
#
####################################################### Change log #######################################################
set VERSION = '8.13' #PDB-REDO version
# Version 8.13:
# - Added an exit and restarting point to combine PDB-REDO results for fragment screens. The keyword to exit after
# rebuilding in '--screen'. To restart the keyword is '--restart_from=temporary_directory_for_job'.
# - When restarting a job, a map for fragment fitting can be passed with --fit_mapin=map_in_CCP4_format.
# - Robustness fix in reporting of validation results.
# - Fix to how cif2cif deals with suspicious sigF and sig I values.
# - Added option to ignore any warnings for sigF and sigI values.
#
# Version 8.12:
# - Updated what_todo to deal with the new mmCIF based extractor.
# - Added full support for FoldIt puzzles from the FoldIt API.
# - FoldIt treatment can be switched off with the --nofoldit option.
# - Added support email address for certain fatal errors.
# - Added a workaround for user jobs where the SEQRES records are in conflict with the atom records.
# - Added a workaround for cases where rerefinement fails for only some weights.
#
# Version 8.11:
# - Temporarily hacking the metal restraint to deal with Refmacat quirks.
# - Added placement of server status files for certain stopping errors.
# - Changed scaling model in refmacat.
#
# Version 8.10:
# - Started using a local version of DNATCO.
# - Bugfix for reading skiplists.
# - Fixed bug that caused loopwhole being needlessly skipped.
# - Switched to CCP4-9.
# - Changed refmacat log reading for cases with strict NCS.
# - Added catch for models that cannot cast to PDB format because of residue names.
# - Because of compatibility issues, residues with 5-character residue names are temporarily ignored in some of the
# validation steps.
#
# Version 8:09:
# - Added a catch for cases that neither the model nor the reflection data has a space group.
# - Bugfix to deal with titles with curly brackets.
#
# Version 8.08:
# - Reactivated molecular replacemne with Molrep to deal with a series of legacy PDB entries.
# - The cut-off for doing MR was lowered to 0.46.
# - Fixed a reporting bug for the c-axis of the unit cell (credit to Karthikeyan Subramanian).
# - Bugfix for dealing with strict NCS.
# - Swapped the order of 0-cycle calculation with or without TLS to fix error with TLS ranges.
# - Fix for logfile reading of the is rigid-body refinement for large models.
# - Added fix so that pdb-redo stops when the first 0-cycle run stops.
# - Added a fix for cases when the free Fourrier Shell Correlation is not reported.
# - pdb2cif now uses user uploaded restraint files.
#
# Version 8.07:
# - Fixed occupancy refinement to exclude residues that have partial alternates.
# - Bugfix in the way cif-merge is run.
# - Added a contingency for DSSP failing in the final model annotation.
# - Relucatntly added some logic to deal with different space group notations in coordinate and reflection files.
# - Fixed logfile parsing issue in case of TLS tensor re-evaluation.
# - Added a catch for trying to run RABDAM on proteins without aspartate or glutamate.
# - Fix in LOGSTEP when the hybrid-36 warning is given by Refmacat and there is a TLS problem.
# - Added a contingency for the input model having more than 200 TLS groups because this breaks Refmacat.
# - Bugfix for twin detection with Phaser.
# - Bugfix for creating the ????_refin.pdb file in case TLS is not used.
# - Added time limits for YASARA's ligand validation.
#
# Version 8.06:
# - Added an option that tests whether an alternative FoldIt model works better in refinement.
# - For the FoldIt implementation resolution-based settings are configured earlier in the pipeline.
# - The FoldIt model selection is only done before the paired refinement. If a new resolution is set the FoldIt test is
# not repeated.
# - Extensive rewiring to make sure the baseline validation scores always come from the PDB model.
# - Replaced pdb2fasta by cif2fasta.
# - User input is now explicitly tested for having the sequence in either the input model or a user provided fasta file.
# - Passing user's restraint files to Refmacat in rigid-body refinement as Gemmi needs them.
# - Started using an mmCIF version of extractor.
# - Added a catch for having an empty extracted TLS goup definition.
# - Added a fix for Refmacat writing corrupt CISPEP records when writing pdb output.
#
# Version 8.05:
# - Changed the B-factor model selection. TLS model selection is now performed first. If successful, the B-factor model
# selection can be ANISO versus ISO + TLS rather than ANISO versus ISO.
# - Started using RABDAM to detect radiation damage.
#
# Version 8.04:
# - Added explicit warning for compounds without restraints.
# - In databank mode restraints are created automatically and added to the local monomer library.
# - Retuned the B-factor model selection to be less conservative.
# - Updated cif2cif to deal with rediculous sigI values (see 8ebi).
# - Bugfix for cases where the second platonyzer run does not generate any restraints.
# - Bugfix for restraints checking while updating the solvent mask parameters in case of a new resolution cut-off.
# - Catch for cases when hybrid-36 files are written.
#
# Version 8.03:
# - Started using Refmacat.
# - FSC values are now also collected. They are reported only for EM models.
# - EM refinement uses tighther jelly body restraints now.
# - Bond length and bond angle rmsZ values in validation now come from REFMAC rather than from WHAT_CHECK.
# - If a previous PDB-REDO has to be collected, PDB-REDO runs in legacy mode without rigid-body refinement.
# - Bugfix in the initial R-factor calculation when rigid-body refinement is switched off.
# - Rigid-body refinement is no longer done by default in legacy mode.
# - Final model is now annotated by DSSP with mmCIF output. Temporarily not using he CCP4 version of DSSP.
#
# Version 8.02:
# - Cell dimension update is now done twice to deal with conflict when mergeing models with cif-merge.
# - Added box size correction for scores based on reflection counts in EM mode.
#
# Version 8.01:
# - New program rama-angles annotates data.json for the Kleywegt-like plot.
# - Fix for cif-merge to use cache.cif.
# - Added boolean support form the input JSON.
# - Added fix for HETATM-only models.
# - Added contingency for unmerged reflections in space groups not supported by SFtools (e.g. P1- in 6y14).
# - Added the --frompdb flag to forcefully start from pdb-formatted entries.
#
# Version 8.00:
# - Operations now start from an mmCIF-formatted coordinate file rather than a PDB-formatted file. PDB input files are
# converted.
# - Major rewrite on input file checks; these now use cif-grep and mmCQL.
# - Added check for space group consistency between model and reflection data.
# - Removed check for SPLIT records as they are now extinct.
# - Removed check for SIGATM and SIGUIJ records as they are no problem in mmCIF files.
# - Slight redesign of ASCII art logo.
# - Removed --pdbin argument. --xyzin should be used instead.
# - Changed protein restraints to EH99/IT2006 with modifications for ARG.
# - Added temporary(?) contingency to allow PDB conversion.
# - No attic for server jobs.
#
# Version 7.38:
# - A compressed FAIRness copy is added which allows the use of permament identifiers.
# - Bugfix for handling additional compounds in density-fitness.
# - Bugfix in the handling of loopwhole failures.
# - Bugfix for using --nopdb when the coordinate file was converted from mmCIF.
# - Added workaround for cases where density-fitness does not work befor loop building.
# - Dropping the JRNL and REMARK 1 records if that causes parsing errors.
# - Added a catch for corrupted versions.json files.
#
# Version 7.37:
# - Bugfix for twinning detection when running in legacy mode.
# - Bugfix for using PDBPeep.
# - Added hidden option to always use isotropic B-facters, no questions asked: --nqa_isotropic.
# - Bugfix for the --notwin option.
#
# Version 7.36:
# - Ligand validation output is now in JSON format.
# - Ligand fitting is slightly more agressive in terms of map fit in Coot.
# - Replaced carbonanza with a new mmCIF enabled version.
# - WHAT_CHECK checkdb files are no longer stored
# - Anomalous maps are now always made regardless of whether Refmac decides that there are anomalous scatterers.
# - Added contingency for loopwhole crashes.
# - SIGATM and SIGUIJ records are now removed.
#
# Version 7.35:
# - Added contingency for problems with modelcompare.
# - Added contingency for compounds deleted by loopwhole that are on the list for ligand validation.
#
# Version 7.34:
# - Added new nucleic acid restraints and updated base pair validation.
# - Removed torsion restraints for nucleic acids.
# - Removed KRAB.
# - Versions of PDB coordinate file and reflections data are now also stored.
# - Added support for a JSON formatted parameter file.
# - Robustness fix for dealing with poor LINK records.
# - Fixed reporting error for flipper.
# - Changed the option --isotropic to also force isotropic B-facturs at high(-ish) resolution.
# - Added the --anisotropic option to force anisotropic B-factorsdown to 13 reflections/atom.
# - Added a workaround for incomplete TER records.
#
# Version 7.33:
# - In databank mode, if a PDB file does not exist we try to convert the mmCIF file after renaming the chains.
# - Added contingency in case fixDMC fails.
# - Moved to a new version of platonyzer with mmCIF support.
#
# Version 7.32:
# - Dropped support for OSX.
# - Software versions are now written in json.
# - Stopped making the YASARA scenes.
# - Nucleic acid restraints are now used in all but the highest resolution categories.
# - Added command line switch --nonucrest.
# - Added nucleic acid specific validation.
# - Bugfix in distel.py to return NA if there are no matched restraints.
# - Bugfix in the way seqrescopier is called.
#
# Version 7.31:
# - Updated the model for the R-factor ratio. It is now empirical based on the PDB-REDO databank.
# - Added a model for sigma value of the R-factor ratio.
# - Decision-making based on the R-free Z-score is now based on the R-factor ratio Z-score.
# - In cases of suspiciously low completeness PDBpeep is used to check whether the reported completeness is ellipsoidal
# rather than spherical.
#
# Version 7.30:
# - Updated picker to perform better when a choice is forced.
# - Added additional step to check quality of TLS refinement.
#
# Version 7.29:
# - Changed the search space for geometric restraint weights.
# - Added contingency for corrupted rwcontents output.
# - Changed the 'make connectivity' setting of Refmac to Refmac's default.
# - Added a molrep run if the R-factor is over 0.50.
# - Now using tortoize to calculate Ramachandran and torsion Z-scores.
# - Using seqrescopier to add back the sequence in all stages.
#
# Version 7.28:
# - The option --nofixdmc switches of fixDMC.
# - Stopped using PDB-care.
# - Isotropic B-factors can be forced with the '--isotropic' flag.
# - Bugfix for when the --download option is used.
#
# Version 7.27:
# - Added contingency for flipper failure.
# - Bugfix for cases where stats fails after the re-refinement.
#
# Version 7.26:
# - The analysis of density fit changes is now done by the new tool dRSCC, removing the dependency on R.
# - Added contingency in case PDB-care does not produce output.
# - The output for stats is now given in JSON format.
# - PDB-care can now be switched of from the command line (--careless).
# - Ligand fitting is now only done when R-free < 0.3500 to avoid false positives.
# - If stats fails after the re-refinement, it is run without the restraint file.
# - If it still fails PDB-REDO stops.
#
# Version 7.25:
# - Cell dimensions in the reflection data in mmCIF format are now retained.
# - If there is a conflict in cell dimensions, the reflection data are now leading.
# - If the coordinate file does not have cell dimensions they are added from the reflection data.
# - Removed 'CRYST1' based tests for input coordinate file.
# - Binliner now reads cell dimensions from the reflection data.
# - Added workaround for cases where metal sites are no longer detected before the final refinement.
# - Unnumbered REMARK records are now stripped out.
#
# Version 7.24:
# - Moved the WHAT_CHECK validation of the input model to after the re-refinement so that it can run in parallel.
# - Some consistency fixes of which input file is used.
# - If prepper cannot parse the input file more verbose output is given to the user and workarounds may be triggered.
#
# Version 7.23:
# - Moved to a new implementation of stripper (now called prepper) that can work with mmCIF.
# - Cleaned up file naming in the initial model editing steps.
# - Added workaround for non-valid XML output from PDB-care.
# - Removed the second pass of PDB-care.
# - Users get an explicit warning if their anomalous data is too incomplete on one of the sides.
# - Bugfix to copying back the SEQRES records to the output.
# - Made the RMSZ cut-offs for cases with RMSZ > 1 tighter.
#
# Version 7.22:
# - Removed the html output and the file compression for the pdb-redo as this output is now generated by the server.
# - Removed the making of boxplots and dRSCC bar charts as this is now also done by the pdb-redo server.
# - The data completeness check is now skipped if paired refinement is forced.
# - Paired refinement output is now more verbose.
#
# Version 7.21:
# - Added workaround for cases where SFCHECK fails.
# - Replaced all Perl code and removed most environment variables and a overal reduction of variables.
# - The EXPDTA record is now also written out.
# - Lowered the initial map threshold for ligand fitting.
# - Fitted ligands are now subjected to occupancy refinement.
# - Paired refinement can now be forced with the '--paired' option.
# - In server mode the output data is no longer precomressed.
#
# Version 7.20:
# - First implementation of carbivore that adds, extends, and corrects N-glycans. This adds a dependancy on
# privateer-validate.
# - Stats now uses the user-provided or auto-generated restraint files if available.
# - Bugfix in handling of corrupt user-provided restraint files.
# - Bugfix in stats stopping errors in server mode.
# - B-factors are reset to 2.00A^2 in stripper if lower.
# - Added contingency if there is no suitable model after the second refinement.
# - Made the cut-offs for ligand fitting less strict to decrease the false negative rate.
#
# Version 7.19:
# - New tool carbonanza adds missing LINKs between ASN and NAG/NDG.
# - Problems with the density plots now cause PDB-REDO to stop.
# - Replaced the Python program rnbterror.py by an improved C++ implementation.
#
# Version 7.18:
# - Bug fix to fixDMC removes false positives for OXT atoms.
# - Centrifuge, pepflip and SideAide exclude lists are now also populated with platonyzer output.
# - Loop building now has an explicit filter on RSCC, which means that the initial fitting is followed Refmac to generate
# refined B-factor values and new map coefficients.
# - Made water deletion in SideAide less agressive.
# - Changed platonyzer restraints.
# - The number of deleted waters is now more reliable.
#
# Version 7.17:
# - Replaced zen by a new program platonyzer that also makes angle restraints for octahedral Na+ and Mg2+.
# - More elegant handling of LINK records.
# - EDIAm and OPIA scores are now reported for new and existing ligands.
# - Changes of EDIAm > |0.1| and OPIA > |12.5%|are now also reported.
#
# Version 7.16:
# - Ligand fitting now uses a new map validation tool that includes the EDIAm metric and removes the Refmac 0-cycle step.
# - Ligands are sorted by size and fitted in order of decreasing size.
# - Because of an update in loopwhole density statistics are also calculated for the besttls model.
#
# Version 7.15:
# - Loop building is now default behaviour. It can be switched off by giving the --noloops flag.
# - Now working with a new version of fixDMC which removes the MCfix dependency.
# - The new fixDMC can handle more complex forms of incomplete residues.
#
# Version 7.14:
# - Added basic mmCIF input support. Currently the mmCIF file is converted to PDB format.
#
# Version 7.13:
# - In server and local mode the additional restraint files are copied to the output directory.
# - Added a fallback and a warning if mmCIF conversion fails.
# - Stability fix that stops Refmac from stopping at later PDB-REDO stages if there are dodgy LINKs.
# - In databank mode, B-factor overflow now causes a stopping error.
#
# Version 7.12:
# - Low resolution side-chain completion is enforced for side-chains deleted by loopwhole.
# - Missing backbone atoms are now added back with fixDMC.
# - Explicitly defining the radiation type for EDSTATS.
#
# Version 7.11:
# - Now also writing mmCIF coordinate files as output.
# - Dropped support for FoldX.
# - Stability fix for partially merged data sets.
# - Added a second validation step for newly fitted ligands.
#
# Version 7.10:
# - Added loopwhole to complete missing loops.
# - Made the 'omit' map generation for low completeness datasets more elegant.
# - Ligands can be fitted with the --fitlig= keyword.
# - The keyword can be given multiple times and fitting occurs sequentially in order of the keywords given.
#
# Version 7.09:
# - Replaced rotacompare with the program modelcompare which also takes over the fuctionality of coot_tour.
# - New txt2json is now run as python3.
#
# Version 7.08:
# - Added restraint geration with KRAB. Use the --krab switch to activate it.
# - Changed the setting for restraint generation in Refmac to 'connectivity YES'.
# - Simplified the way the version-tracking file is made.
# - In electron diffraction mode, no anomalous maps are made.
#
# Version 7.07:
# - If the R-factor cannot be reproduced in databank mode, but a previous PDB-REDO entry exists, the 0-cycle coordinates
# are downloaded and used to try to reproduce the R-factors.
# - The hidden --norb switch switches off rigid-body refinement, even in legacy mode.
#
# Version 7.06:
# - More elegant overwriting of databank entries. This does mean that old data in the output directory is removed.
# - The PDBe.json files are now always created.
# - The index.html files are no longer created.
# - WHYNOT and DEBUG messages for server runs go to a seperate WHYNOT file.
#
# Version 7.05:
# - Updated data for percentile calculation and boxplots.
# - Now also calculating percentiles for coarse packing.
# - CB atoms of GLY are removed automatically.
#
# Version 7.04:
# - REMARK 350 records (biological assembly) are now retained if available.
# - Workaround for cases with alternate residues that get mangled by the rebuilding tools.
# - Workaround for cases with a rediculous amount of TLS groups.
# - Better handling of carbohydrate LINKs with alternates.
#
# Version 7.03:
# - With '--homin=homologous_pdb_file' users can add additional homologous structures that are not yet in the PDB to
# improve the homology restraints.
# - This option automatically triggers homology restraints.
# - Bugfix in writing out the refmac script for low resolution cases.
# - The DNA/RNA restraints from LibG are no longer a hidden option.
# - Fix importing external restraints.
#
# Version 7.02:
# - Added symmetry support for Zen. This required generation of a temporary mtz file early in PDB-REDO.
# - More elegant handling of TLS groups not working in TLSanl.
# - Experimental phases without HL coefficients or FOMs are supplemented with default FOMs.
# - If the NCS alignment failes due to terminal insertion codes. The residues are now automatically renumbered.
# - Bugfix for cases that have problems with ctruncate and have relatively small test sets.
#
# Version 7.01:
# - Changed the slider values for PDBe to make sure that the step from neutral to positive happens for values greater than
# 2.58.
# - More elegant handling of unstable TLS refinement.
# - More elegant handling of cases where no TLS file could be made.
# - Better handling of cases where Refmac refuses to make anomalous maps.
# - More elegant handling of cases where LibG does not make all types of restraints.
# - Bug fix in the way Phaser errors are intercepted.
# - Fix for reading logfiles of backbone-only models.
#
# Version 7.00:
# - rmsZ values for (homology-based) H-bond restraints are now reported.
# - Better handling for missing high resolution data.
# - Changed the way data.txt is written to avoid race conditions.
#
# A complete changelog is available from the PDB-REDO website
#
echo " "
if ($1 == "--local" || $1 == "--server") then
set PDBID = `mktemp -u XXXX`
else
set PDBID = $1
#Check the validity of the PDBid
if ($PDBID != `echo $PDBID | cut -c 1-4`) then
echo "This is not a valid PDB identifier. Cannot continue."
exit(1)
endif
endif
set D2 = `echo $PDBID | cut -c 2-3` #Essential for certain environment values
# Check wether PDB-REDO is properly configured.
setenv TOOLS $BASE/tools #Directory with PDB-REDO software and data
if (! -e $TOOLS/pdb_redo.setup) then
#PDB_REDO is not properly installed or configured.
echo "FATAL ERROR!"
echo "------------"
echo "PDB-REDO cannot find its installation directory."
echo "Please, set the correct value for 'BASE' in $0 on line 6."
exit(1)
else
#set additional environment parameters (define directories and files).
source $TOOLS/pdb_redo.setup
endif
########################## Initialise important variables. Usually no need to edit this ##################################
#Add extra libraries
if ($?LD_LIBRARY_PATH) then
setenv LD_LIBRARY_PATH $TOOLS/lib:$LD_LIBRARY_PATH
else
setenv LD_LIBRARY_PATH $TOOLS/lib
endif
#Refinement parameters
set NCYCLE = 20 #Initial number of (restrained) refinement cycles
set RBCYCLE = 10 #Number of rigid-body refinement cycles
set BTESTCYC = 10 #Number of restrained refinement cycles in the B-restraint weight optimisation
set TLSCYCLE = 15 #Number of TLS-refinement cycles
set TLSCMD = #Empty TLS command
set TLSFILS = #No TLS files specified
set DOTLS = 1 #Use TLS
set TLSUPDATE = 1 #Update TLS tensors in final refinement
set OPTTLSG = 'none' #Fallback value if no TLS is used in refinement
set TIME = `date +'%F'`
set BCMD = #Don't change the B-factors
set WGTTYPE = MATRIX #Use weight matrix by default
set BREFTYPE = ISOT #Do isotropic B-factor refinement by default
set NCSTYPE = #Empty NCS command
set RBNCS = #No NCS during rigid-body refinement
set NCSALIGN = #Only usefull when NCS is used (alignment cut-off)
set NCSNEIGH = #Only usefull when NCS is used (include neighbouring atoms in restraints)
set SOLVENT = SIMP #Use simple solvent model by default
set MASKPAR = #Use default masking parameters
set JELLY = #Do not use 'jelly body' refinement by default
set TORSION = #Do not use torsion restraints by default
set LOGSTEP = 26 #Line number of Refmac log with required output (counted backwards)
set ESTRICT = #Picker is not extra strict
set SHIFTCO = 0.50 #Cut-off for atomic shift in ligand validation
set EXTSCAL = 10 #Scale for external restraints
set REFIRES = #Resolution cut-offs for refinement; use all data by default
set OCCCMD = #Occupancy refinement commands
set METALCMD = #Command for metal site restraints
set RESTCMD = #Command for external restraints
set NUCRCMD = #DNA/RNA restraints commands
set HBONDWGTCMD = #Command for weighting external hydrogen bond restraints
set HBONDCMD = #Command for using hydrogen bond restraints
set HBRESTRWGT = 2 #Hydrogen bond restraint weight
set NHBONDREST = 0 #Number of H-bond restraints
set HOMOLWGTCMD = #Command for weighting external homology restraints
set HOMOLCMD = #Command for using homology restraints
set HOMOLRESTRWGT = 2 #Homology restraint weight
set NHOMOLREST = 0 #Number of homology restraints
set HOMINCMD = #Command for extra homologous structures
set HARMCMD = #Harmonic restraints command
set WAVELCACHE = #Wavelength cashed from input MTZ file
set MAXPRUNE = 20 #Give up after removing MAXPRUNE restraints
set SCATLIN = #Line that overruls the default scattering factor file
set SCATTERCMD = #Use the default X-ray scattering factors
set PHASES = #No phase columns as input by default
set ANOMCOEF = #Input anomalous data for Refmac
set ANOMCMD = #Command for anomalous refinement
set FASTAIN = #No input fasta by default
set DICTCMD = #No dictionary to append by default
set DICTCMDDF = #No dictionary to append by default to density-fitness
#Refmac settings
set CONNECTIVITY = #Empty value uses Refmac's default other options are 'connectivity [YES|NO|DEFINE]'
set SUGAR = #Empty value uses Refmac's default other options are 'sugar [YES|NO|DEFINE]'
set RSYMM = #Empty value uses Refmac's default other options are 'symmetry [YES|NO]'
#Default values
set NTLS = 0 #Zero TLS groups by default. The number of groups is reset when TLS is used
set NPRUNEM = 0 #No metal restraints pruned yet
set NPRUNEN = 0 #No nucleic acid restraints pruned yet
set NPRUNE = 0 #Total number of pruned restraints
set NMETALREST = 0 #No metal restraints to start with
set NMETALREST2 = 0 #No metal restraints to start with
set NNUCLEICREST = 0 #No nucleic acid restraints to start with
set EXPTYP = 'X-ray' #The type of experiment
set GOTOLD = 0 #By default not starting with previous PDB-REDO entry
set NUMBERING = #The file with the residue numbering mapping from rnbterror
set NLIG_LIST = #No newly added ligands
set OXTADD = #Add OXT atoms by default
set TRUSTSEQ = 0 #Trust the sequence by default
set SFTYPE = #Set scattering type for density-fitness (Default: X-ray)
set DIDMR = 0 #No molecular replacement was done
set PREPPERRETRY = 0 #Number of prepper retries
set CELLUPDATE = 0 #Were the cell dimensions in the model updated
set BOXSCALE = 1.0 #Default correction for box sizes (EM only)
set ISEM = 0 #Assume it is not an EM structure model
set NEWREST = 0 #No new restraints made yet
#Error flags
set TTEST = 0 #No errors in the TLS group optimisation
set UTRUNCATE = 0 #Truncate was not used
#Deal with potentially missing sigF/sigI values
set EXPSIG = 'n' #Do not use experimental sigmas for scaling
set WGTSIG = #Use experimental sigmas for scaling
#Debug flags and derivatives
set NOPDB = 0
set CEDIT = false #The coordinate file is edited from the original PDB entry
set NOSF = 0
set REDIT = false #The relection file is edited from the original PDB entry
set FROMPDB = 0 #Do not use the PDB formatted file from the PDB
set USEMTZ = 0
set DOWNLOAD = 0
set NOHYD = 0
set HYDROGEN = ALL
set LEGACY = 0
set DOTWIN = 1
set DOHARMONIC = 1 #Use harmonic restraints if needed
set TWIN = 'test' #By default test for twinning
set ISTWIN = 0 #Data not treated as twinned
set FALSETWIN = 0 #Data not previously incrorrectly treated as twinned
set ISED = 0 #this is an electron diffraction set
set DOTASER = 0
set DOPEPFLIP = 1
set DOSCBUILD = 1
set DOCENTRIFUGE = 1
set DOREBUILD = 1
set DOSUGARBUILD = 1
set DOFIXDMC = 1 #Use fixDMC by default
set DONCS = 1
set DORB = 1
set RESOCHECK = 1
set DOJELLY = 1 #Allow jelly-body refinement
set DOMETALREST = 1 #Use special metal restraints by default
set DOFOLDIT = 1 #Consider using a FoldIt puzzle solution as starting model
set FIUSED = 0 #Was a FoldIt model used as starting model
set STRICTNCS = 0
set NCSSTRICT = #Empty strict NCS keyword for Refmac
set LOCAL = 0
set SERVER = 0
set NPROC = 1 #Default number of processors to use
set MAXPROC = 20 #The maximum number of processors to use
set XYZIN =
set HKLIN =
set MTZIN =
set PARAMS = #No parameter file specified
set XTLS = #User submitted TLS files
set XHOM = #User submitted homologous structure models
set INREST = #The location of the geometric restraint file
set INEXT = #The location of the external restraint file
set INSEQ = #The location of the input sequence
set RELAX =
set NEWMODEL =
set LOWMEM =
set FEWREFS =
set CROSS = 0
set C2CERR = 0
set INTENS = #Use intensities if set to '-i'
set USTATUS = #Use the reflection status column. Set to '-s' to create a new R-free set
set SIGMA =
set USIGMA = 1 #Set to 0 to ignore sigma values
set ANYSIGMA = 0 #Set to 1 to use sigma values, even when they are suspicious
set C2CCONV = #Set to '-c' to convert intensities to amplitudes with cif2cif instead of ctruncate
set DOOCC = 1 #Refine occupancies for certain residues
set DONUCR = 1 #Use nucleic acid restraints by default
set CLEAN = 0
set RESCATSTEP = 0 #Do not change the resolution category
set SSBOND = 'YES' #Autodetect disulfide bridges in Refmac
set HBONDREST = 0
set DOHOMOLOGY = 0 #Do not use homology restraints by default
set NOHOMOLOGY = 0 #Modifier to switch off homology restraints
set FORCEPAIRED = 0 #Force paired refinenement if set to 1
set SMODE = #Running mode for prepper
set C2CANO = '-a' #Run cif2cif in anomalous mode
set DOLOOPS = 1 #Complete loops with loopwhole
set FITLIGANDS = 0 #Do not fit ligands by default
set FITLIGS = #Ligands to fit
set BISOT = 0 #Do the Hamilton test to select the B-factor model (ISOT vs OVER and ISOT vs ANISOT)
set FISOT = 0 #Force isotropic B-factors, no questions asked
set BANISOT = 0 #Do the Hamilton test to select the B-factor model (ISOT vs ANISOT)
set COMPERROR = 0 #No error in the completeness
set SCREEN = 0 #If set to 1 PDB-REDO dumps all variables and exists after rebuilding.
set RESTART = 0 #If set to one start from stored settings and jump to the fragement fitting step.
#Other settings
set WEBGET = 'wget -q'
#Rebuilding settings
set NO_REBUILD = #List of residues that must not be rebuilt
set H2O_KEEP = #List of waters to keep without question
#Legacy values
set OGFOLD = 'NA' #Output scores from FoldX
set NGFOLD = 'NA' #Output scores from FoldX
set FGFOLD = 'NA' #Output scores from FoldX
############################################### You need not edit beyond this line #######################################
#Make sure the LOG file can be created (the :h modifier removes the filename from $LOG leaving only the directory)
mkdir -p $LOG:h
#make a temporary log file
if ($1 == "--local") then
echo "Results from PDB-REDO $*" > $LOG
endif
#Write out header
echo " __ __ __ __ ___ __ __ _ __ " | tee -a $LOG
echo "|__) | \ |__) _ |__) |__ | \ / \ (_) /| __)" | tee -a $LOG
echo "| |__/ |__) | \ |___ |__/ \__/ (_) o | __)" | tee -a $LOG
echo " "
#Font for the header
# __ __ __ __ _ __ _ _
#/ /\ /| _) __) |_| |_ |_ / (_) (_|
#\/_/ | /__ __) | __) |_) / (_) _|
############################################### Check for debug flags ####################################################
#Get debug flags
echo " " | tee -a $LOG
echo "****** Optimisation setup ******" | tee -a $LOG
foreach ARG ($*)
if ($ARG == $PDBID) then
echo "-Evaluating PDB entry $PDBID" | tee -a $LOG
else if ($ARG == "--local") then
set LOCAL = 1
#Set additional flags for programs
set RELAX = "-r" #Relaxed mode for extractor
set SMODE = '--server' #Server mode for prepper
else if ($ARG == "--server") then
set LOCAL = 1
set SERVER = 1
set STDIR = $cwd
#Write different debug files
set WHYNOT = $WHYNOT.server
set DEBUG = $DEBUG.server
#Make the running status file
touch $STDIR/processRunning.txt
#Reset the logfile
mkdir -p $STDIR/output
cat $LOG >> $STDIR/output/process.log
setenv LOG $STDIR/output/process.log
#Set additional flags for programs
set RELAX = "-r" #Relaxed mode for extractor
set SMODE = '--server' #Server mode for prepper
else if (`echo $ARG | cut -c 1-8` == "--xyzin=") then
#Get the file in two steps to expand relative paths, but also paths using '~'
set XYZIN = `echo $ARG | cut -d '=' -f 2-`
set XYZIN = `readlink -m $XYZIN`
echo "-PDB-REDO will optimise the structure model in $XYZIN" | tee -a $LOG
else if (`echo $ARG | cut -c 1-12` == "--fit_mapin=") then
#Get the file in two steps to expand relative paths, but also paths using '~'
set FMAPIN = `echo $ARG | cut -d '=' -f 2-`
set FMAPIN = `readlink -m $FMAPIN`
echo "-PDB-REDO will look for ligands/fragments in $FMAPIN" | tee -a $LOG
else if (`echo $ARG | cut -c 1-8` == "--hklin=") then
set HKLIN = `echo $ARG | cut -d '=' -f 2-`
set HKLIN = `readlink -m $HKLIN`
#Choose the mmCIF file if two reflection files are specified
if ($MTZIN != "") then
echo "-You specified two reflection files. Using $HKLIN" | tee -a $LOG
set MTZIN =
else
echo "-Using the experimental data in $HKLIN" | tee -a $LOG
endif
else if (`echo $ARG | cut -c 1-8` == "--mtzin=") then
#Choose the mmCIF file if two reflection files are specified
if ($HKLIN != "") then
echo "-You specified two reflection files. Using $HKLIN" | tee -a $LOG
else
set MTZIN = `echo $ARG | cut -d '=' -f 2-`
set MTZIN = `readlink -m $MTZIN`
echo "-Using the experimental data in $MTZIN" | tee -a $LOG
endif
else if (`echo $ARG | cut -c 1-9` == "--dirout=") then
set OUTPUT = `echo $ARG | cut -d '=' -f 2-`
set OUTPUT = `readlink -m $OUTPUT`
else if (`echo $ARG | cut -c 1-9` == "--params=") then
set PARAMS = `echo $ARG | cut -d '=' -f 2-`
set PARAMS = `readlink -m $PARAMS`
else if (`echo $ARG | cut -c 1-8` == "--tlsin=") then
set INTLS = `echo $ARG | cut -d '=' -f 2-`
set INTLS = `readlink -m $INTLS`
echo "-Testing TLS group definitions from $INTLS" | tee -a $LOG
#Push the input TLS file on a stack
set XTLS = `echo $XTLS $INTLS`
else if (`echo $ARG | cut -c 1-8` == "--homin=") then
set INHOM = `echo $ARG | cut -d '=' -f 2-`
set INHOM = `readlink -m $INHOM`
echo "-Using homologous structure model $INHOM" | tee -a $LOG
#Push the input homologous file on a stack
set XHOM = `echo $XHOM $INHOM`
else if (`echo $ARG | cut -c 1-9` == "--fitlig=") then
set FITLIG = `echo $ARG | cut -d '=' -f 2-`
echo "-Trying to fit ligand $FITLIG" | tee -a $LOG
#Add the ligand to the list
set FITLIGS = `echo $FITLIGS $FITLIG`
set FITLIGANDS = 1
else if (`echo $ARG | cut -c 1-9` == "--restin=") then
set INREST = `echo $ARG | cut -d '=' -f 2-`
set INREST = `readlink -m $INREST`
echo "-Using geometric restraints from $INREST" | tee -a $LOG
else if (`echo $ARG | cut -c 1-8` == "--extin=") then
set INEXT = `echo $ARG | cut -d '=' -f 2-`
set INEXT = `readlink -m $INEXT`
echo "-Using additional restraints from $INEXT" | tee -a $LOG
else if (`echo $ARG | cut -c 1-8` == "--seqin=") then
set INSEQ = `echo $ARG | cut -d '=' -f 2-`
set INSEQ = `readlink -m $INSEQ`
echo "-Using sequence from $INSEQ" | tee -a $LOG
else if (`echo $ARG | cut -c 1-15` == "--restart_from=") then
set RESTART = 1
set RSDIR = `echo $ARG | cut -d '=' -f 2-`
set RSDIR = `readlink -m $RSDIR`
echo "-Restarting from data in $RSDIR" | tee -a $LOG
else if (`echo $ARG | cut -c 1-8` == "--nproc=") then
#Using multiple CPUs
set NPROC = `echo $ARG | cut -d '=' -f 2-`
#Is the value an integer?
test $NPROC -eq $NPROC >& /dev/null
if ($status) then
#Not an integer, use a single core
set NPROC = 1
echo "-Using $NPROC CPU core" | tee -a $LOG
else
if ($NPROC < 1) then
set NPROC = 1
else if ($NPROC > $MAXPROC) then
set NPROC = $MAXPROC
endif
echo "-Using a maximum of $NPROC CPU cores where possible" | tee -a $LOG
endif
else if ($ARG == --nopdb) then
set NOPDB = 1
echo "-Keeping the PDB file in the working directory" | tee -a $LOG
#Assume the file was edited
set CEDIT = true
else if ($ARG == --frompdb) then
set FROMPDB = 1
echo "-Starting from PDB-formatted PDB entry" | tee -a $LOG
else if ($ARG == --nosf) then
set NOSF = 1
echo "-Keeping the reflection file in the working directory" | tee -a $LOG
#Assume the file was edited
set REDIT = true
else if ($ARG == --mtzdb) then
set USEMTZ = 1
echo "-The reflection data in the data bank will be treated as MTZ" | tee -a $LOG
set MTZIN = $SF/r${PDBID}sf.mtz
else if ($ARG == --download) then
set DOWNLOAD = 1
echo "-The required files will be downloaded" | tee -a $LOG
else if ($ARG == --nohyd) then
set NOHYD = 1
set HYDROGEN = NO
echo "-Hydrogens will NOT be added in the riding position during refinement" | tee -a $LOG
else if ($ARG == --legacy) then
set LEGACY = 1
echo "-The PDB file will be treated as a legacy PDB entry" | tee -a $LOG
else if ($ARG == --tighter) then
@ RESCATSTEP = ($RESCATSTEP - 1)
echo "-Trying tighter-than-default restraints" | tee -a $LOG
else if ($ARG == --looser) then
@ RESCATSTEP = ($RESCATSTEP + 1)
echo "-Trying looser-than-default restraints" | tee -a $LOG
else if ($ARG == --notls) then
set DOTLS = 0
echo "-No TLS refinement will be performed" | tee -a $LOG
else if ($ARG == --notlsupdate) then
set TLSUPDATE = 0
echo "-No additional TLS refinement will be performed after rebuilding" | tee -a $LOG
else if ($ARG == --noncs) then
set DONCS = 0
echo "-No NCS restraints will be used" | tee -a $LOG
else if ($ARG == --nojelly) then
set DOJELLY = 0
echo "-Not doing jelly-body refinement" | tee -a $LOG
else if ($ARG == --norb) then
set DORB = 0
echo "-Not doing rigid-body refinement" | tee -a $LOG
else if ($ARG == --noharmonic) then
set DOHARMONIC = 0
echo "-Not using harmonic restraints for small datasets" | tee -a $LOG
else if ($ARG == --nometalrest) then
set DOMETALREST = 0
echo "-Not using additional metal site restraints" | tee -a $LOG
else if ($ARG == --notwin) then
set TWIN = "" #No detwinning
set DOTWIN = 0
echo "-No detwinning will be performed" | tee -a $LOG
else if ($ARG == --noanomalous) then
set C2CANO = ""
echo "-Anomalous data will be ignored" | tee -a $LOG
else if ($ARG == --newmodel) then
set NEWMODEL = "-f" #Force rerefinement to finish with new model
echo "-Rerefinement will always return a new model" | tee -a $LOG
else if ($ARG == --nocentrifuge) then
set DOCENTRIFUGE = 0 #No water deletion
echo "-Poor waters will not be deleted" | tee -a $LOG
else if ($ARG == --nopepflip) then
set DOPEPFLIP = 0 #No peptide flips
echo "-No peptide flips will be performed" | tee -a $LOG
else if ($ARG == --noscbuild) then
set DOSCBUILD = 0 #No side chain rebuilding
echo "-Side chains will not be rebuilt" | tee -a $LOG
else if ($ARG == --norebuild) then
set DOREBUILD = 0 #No rebuilding at all
echo "-No rebuilding at all" | tee -a $LOG
else if ($ARG == --nosugarbuild) then
set DOSUGARBUILD = 0 #No sugar rebuilding at all
echo "-No sugar (re)building at all" | tee -a $LOG
else if ($ARG == --nonucrest) then
set DONUCR = 0 #Do not generate basepair and stacking restraints
echo "-Not using DNA/RNA restraints" | tee -a $LOG
else if ($ARG == --noocc) then
set DOOCC = 0 #No occupancy refinement
echo "-No occupancy refinement" | tee -a $LOG
else if ($ARG == --notruncate) then
set C2CCONV = '-c' #Use cif2cif instead of ctruncate to convert intensities
echo "-Not using truncate" | tee -a $LOG
else if ($ARG == --lowmem) then
#Reduce Refmac's memory consumption by not 'cleaning' the solvent mask
set LOWMEM = "solvent process islands noremove"
echo "-Working in limited memory mode" | tee -a $LOG
else if ($ARG == --crossval) then
set CROSS = 1
echo "-Full k-fold cross validation will be performed" | tee -a $LOG
else if ($ARG == --fewrefs) then
set FEWREFS = "-n"
echo "-Working with very small data set" | tee -a $LOG
else if (`echo $ARG | cut -c 1-9` == "--maxres=") then
set MRESO = `echo $ARG | cut -d '=' -f 2-`
echo "-The data will be cut to $MRESO A" | tee -a $LOG
else if ($ARG == --intens) then
set INTENS = "-i"
echo "-Using intensities from the reflection file" | tee -a $LOG
else if ($ARG == --nosigma) then
set SIGMA = "-g"
set USIGMA = 0
echo "-Not using sigF or sigI values from reflection file" | tee -a $LOG
else if ($ARG == --anysigma) then
set ANYSIGMA = 1
echo "-Not checking sigF or sigI quality" | tee -a $LOG