From e79926dde413f6e2d995c298f3974fbba081521d Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Wed, 1 Mar 2023 12:05:45 +0100 Subject: [PATCH] compare-structures: add fault_tolerant parsing --- actions/ost-compare-structures-new | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/actions/ost-compare-structures-new b/actions/ost-compare-structures-new index 0f66704b6..1e7460264 100644 --- a/actions/ost-compare-structures-new +++ b/actions/ost-compare-structures-new @@ -141,6 +141,14 @@ def _ParseArgs(): help=("Use this suffix to dump structures.\n" "Defaults to .compare.structures.pdb.")) + parser.add_argument( + "-ft", + "--fault-tolerant", + dest="fault_tolerant", + default=False, + action="store_true", + help=("Fault tolerant parsing.")) + parser.add_argument( "--lddt", dest="lddt", @@ -266,7 +274,7 @@ def _ParseArgs(): return parser.parse_args() -def _LoadStructure(structure_path, sformat=None): +def _LoadStructure(structure_path, sformat=None, fault_tolerant=False): """Read OST entity either from mmCIF or PDB. The returned structure has structure_path attached as structure name @@ -289,11 +297,11 @@ def _LoadStructure(structure_path, sformat=None): ost.PushVerbosityLevel(ost.LogLevel.Error) # Load the structure if sformat in ["mmcif", "cif"]: - entity = io.LoadMMCIF(structure_path) + entity = io.LoadMMCIF(structure_path, fault_tolerant = fault_tolerant) if len(entity.residues) == 0: raise Exception(f"No residues found in file: {structure_path}") elif sformat == "pdb": - entity = io.LoadPDB(structure_path) + entity = io.LoadPDB(structure_path, fault_tolerant = fault_tolerant) if len(entity.residues) == 0: raise Exception(f"No residues found in file: {structure_path}") else: @@ -403,8 +411,11 @@ def _Main(): args = _ParseArgs() try: reference = _LoadStructure(args.reference, - sformat=args.reference_format) - model = _LoadStructure(args.model, sformat=args.model_format) + sformat=args.reference_format, + fault_tolerant = args.fault_tolerant) + model = _LoadStructure(args.model, + sformat=args.model_format, + fault_tolerant = args.fault_tolerant) out = _Process(model, reference, args) out["status"] = "SUCCESS" with open(args.output, 'w') as fh: -- GitLab