OCDocker.Toolbox.Validation module¶
Sets of classes and functions that are used to validate data.
Usage:
import OCDocker.Toolbox.Validation as ocvalidation
- OCDocker.Toolbox.Validation.is_algorithm_allowed(path)[source]¶
Finds if the given dir is a folder from an allowed algorithm.
- Parameters:
path (str) – Path to the dir which will be tested. The algorithm list and their shortcodes: - AffinityPropagation: ap - AgglomerativeClustering: ac - Birch: bi - DBSCAN: db - KMeans: km - MeanShift: ms - MiniBatchKMeans: mb - NoCluster: na - OPTICS: op - SpectralClustering: sc
- Returns:
True if the dir is an allowed algorithm, False otherwise.
- Return type:
bool
- OCDocker.Toolbox.Validation.is_molecule_valid(molecule)[source]¶
Check if a molecule is valid (protein or ligand).
- Parameters:
molecule (str) – The molecule to be checked.
- Returns:
True if the molecule is valid, False otherwise.
- Return type:
bool
- OCDocker.Toolbox.Validation.is_molecule_valid_with_retry(molecule, retries=5, delay=1.0)[source]¶
Check if a molecule is valid, retrying when the file is empty or mid-write.
- Parameters:
molecule (str) – The molecule to be checked.
retries (int, optional) – Number of read attempts before giving up. Default is 5.
delay (float, optional) – Delay in seconds between attempts. Default is 1.0.
- Returns:
True if the molecule is valid within the retry window, False otherwise.
- Return type:
bool
- OCDocker.Toolbox.Validation.validate_digest_extension(digestPath, digestFormat)[source]¶
Validates the digest extension.
- Parameters:
digestPath (str) – The digest file path.
digestFormat (str) – The format of the digest file. The options are: [ json (default), hdf5 (not implemented) ]
- Returns:
If the extension is supported or not.
- Return type:
bool
- OCDocker.Toolbox.Validation.validate_obabel_extension(path)[source]¶
Validate the input file extension to ensure the compability with obabel lib.
- Parameters:
path (str) – Path to the input file.
- Returns:
The exit code of the command (based on the Error.py code table) if fails or the extension otherwise.
- Return type:
str | int