Skip to content

Commit 1e3ecb2

Browse files
Alan Christiealanbchristie
Alan Christie
authored andcommitted
fix: One of lhs_pdb and ref_pdb is required
1 parent a3aa0c4 commit 1e3ecb2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

viewer/sdf_check.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,18 @@ def missing_field_check(mol, field, validate_dict):
324324

325325

326326
def check_mol_props(mol, validate_dict):
327-
# check for missing fields
328-
fields = ['ref_pdb', 'ref_mols', 'original SMILES']
327+
# Check for (mandatory, isolated) missing fields
328+
fields = ['ref_mols', 'original SMILES']
329329
for field in fields:
330330
validate_dict = missing_field_check(mol, field, validate_dict)
331+
# More complex checks?
332+
# One of ref_pdb and lhs_pdb must be set
333+
if not (mol.HasProp('ref_pdb') or mol.HasProp('lhs_pdb')):
334+
validate_dict = add_warning(
335+
molecule_name=mol.GetProp('_Name'),
336+
field='ref_pdb/lhs_pdb',
337+
warning_string="Molecule has neither 'ref_pdb' nor 'lhs_pdb' property",
338+
validate_dict=validate_dict,
339+
)
331340

332341
return validate_dict

0 commit comments

Comments
 (0)