schrodinger.application.transforms.validators module

These validator functions are intended to be used in the __init__ method of PTransform classes to validate the arguments passed to the PTransform.

When the validation fails, a ValueError is raised with a message that describes the issue.

schrodinger.application.transforms.validators.validate_optional_int(value: Optional[int], what: str) None

Check that the value is None or an int.

schrodinger.application.transforms.validators.validate_nonzero_positive_int(n: Any, what: str) None

Check that the value is a non-zero positive int.

schrodinger.application.transforms.validators.validate_positive_int(n: Any, what: str) None

Check that the value is a positive int.

schrodinger.application.transforms.validators.validate_nonzero_positive_number(n: Any, what: str) None

Check that the value is a non-zero positive float.

schrodinger.application.transforms.validators.validate_smiles(smiles: str, what: str = 'SMILES') None

Check that the SMILES string is valid.

schrodinger.application.transforms.validators.validate_smarts(smarts: str, what: str = 'SMARTS') None

Check that the SMARTS string is valid.

schrodinger.application.transforms.validators.validate_smarts_for_mol(mol: rdkit.Chem.rdchem.Mol, smarts: str, what: str) None

Check that the molecule has a match with the SMARTS string.

schrodinger.application.transforms.validators.validate_smarts_for_structure(st: schrodinger.structure._structure.Structure, smarts: str, what: str) None

Check that the structure has a match with the SMARTS string.

schrodinger.application.transforms.validators.validate_path_exists(path: pathlib.Path, what: str = 'Path') None

Check that the path exists.

schrodinger.application.transforms.validators.validate_non_empty_smiles_path(path: pathlib.Path, what: str = 'Path') None

Check that the path exists and contains at least one valid SMILES string.

schrodinger.application.transforms.validators.validate_property_ranges(property_ranges: Dict[str, List[float]]) None

Check that the property ranges have valid RDKit names and ranges.

Raises

ValueError – if the property_ranges are invalid

schrodinger.application.transforms.validators.validate_structure_property_ranges(property_ranges: Dict[str, List[float]]) None

Check that the structure property ranges have valid structure property names and ranges.

Raises

ValueError – if the property_ranges are invalid

schrodinger.application.transforms.validators.is_valid_rdkit_property_name(property_name: str) bool

Check if the property name is a valid RDKit property name.

schrodinger.application.transforms.validators.validate_structure_property_name(property_name: str, valid_types: Set[str]) None

Check that the property name is a valid structure property name.

Parameters
  • property_name – the name of the property

  • valid_types – the valid types for the property ‘s’, ‘r’, ‘i’, ‘b’

Raises

ValueError – if the property_ranges are invalid

schrodinger.application.transforms.validators.validate_range(range_: List[float]) None

Check that the range is valid.

Raises

ValueError – if the range is invalid