Skip to content
Snippets Groups Projects
Unverified Commit ccb50271 authored by Xavier Robin's avatar Xavier Robin
Browse files

feat: SCHWED-5481 validate with fault_tolerant

parent 29b2180b
Branches
Tags
No related merge requests found
...@@ -234,7 +234,7 @@ def _LoadLigand(file): ...@@ -234,7 +234,7 @@ def _LoadLigand(file):
return ligand_ent.Copy() return ligand_ent.Copy()
def _Validate(structure, ligands, legend): def _Validate(structure, ligands, legend, fault_tolerant=False):
"""Validate the structure. """Validate the structure.
If fault_tolerant is True, only warns in case of problems. If False, If fault_tolerant is True, only warns in case of problems. If False,
...@@ -245,9 +245,12 @@ def _Validate(structure, ligands, legend): ...@@ -245,9 +245,12 @@ def _Validate(structure, ligands, legend):
if ligands is not None: if ligands is not None:
for residue in structure.residues: for residue in structure.residues:
if residue.is_ligand: if residue.is_ligand:
warnings.warn("Ligand residue %s found in %s polymer structure" %( msg = "Ligand residue %s found in %s polymer structure" %(
residue.qualified_name, legend residue.qualified_name, legend)
), UserWarning) if fault_tolerant:
ost.LogWarning(msg)
else:
raise ValueError(msg)
def _Process(model, model_ligands, reference, reference_ligands, args): def _Process(model, model_ligands, reference, reference_ligands, args):
...@@ -328,8 +331,10 @@ def _Main(): ...@@ -328,8 +331,10 @@ def _Main():
reference_ligands = _LoadLigands(args.reference_ligands) reference_ligands = _LoadLigands(args.reference_ligands)
# Validate # Validate
_Validate(model, model_ligands, "model") _Validate(model, model_ligands, "model",
_Validate(reference, reference_ligands, "reference") fault_tolerant = args.fault_tolerant)
_Validate(reference, reference_ligands, "reference",
fault_tolerant = args.fault_tolerant)
out = _Process(model, model_ligands, reference, reference_ligands, args) out = _Process(model, model_ligands, reference, reference_ligands, args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment