gt4sd.properties.utils module

Summary

Functions:

docking_import_check

Verifies that __some__ of the required packages for docking are installed.

get_activity_fn

Get a function to measure activity/affinity against a protein target.

get_descriptor

Convert a macromolecule to a modlamp GlobalDescriptor object.

get_sequence

Safely returns an amino acid sequence of a macromolecule

get_similarity_fn

Get a similarity function for a target molecule.

get_target_parameters

Generates a tuple of scorers and weight list

to_mol

Safely convert a string or a rdkit.Chem.Mol to a rdkit.Chem.Mol.

to_smiles

Safely returns a SMILES string from a SMILES or a rdkit.Chem.Mol object.

validate_api_token

Validates whether the parameter configuration contains something that _could_ be a valid API key.

validate_ip

Validates whether the parameter configuration contains a correct IP address.

Reference

to_mol(mol)[source]

Safely convert a string or a rdkit.Chem.Mol to a rdkit.Chem.Mol.

Parameters

mol (Union[str, Mol]) – a string or a rdkit.Chem.Mol object.

Raises

TypeError – if wrong type is given.

Return type

Mol

Returns

a rdkit.Chem.Mol object.

to_smiles(mol)[source]

Safely returns a SMILES string from a SMILES or a rdkit.Chem.Mol object.

Parameters

SmallMolecule – either a SMILES or a rdkit.Chem.Mol object.

Return type

str

Returns

a SMILES string.

get_similarity_fn(target_mol, fp_key='FCFP4')[source]

Get a similarity function for a target molecule.

Parameters
  • target_mol (Union[str, Mol]) – a target molecule as SMILES or rdkit.Chem.Mol object.

  • fp_key (str) – The type of fingerprint to use. One of ECFP4, ECFP6, FCFP4 and AP.

Return type

Callable[[Union[str, Mol]], Union[float, int]]

Returns

a similarity function that can be called with a SmallMolecule.

get_activity_fn(target)[source]

Get a function to measure activity/affinity against a protein target.

Parameters

target (str) – name of the target protein.

Return type

Callable[[Union[str, Mol]], Union[float, int]]

Returns

an affinity function that can be called with a SmallMolecule.

get_sequence(protein)[source]

Safely returns an amino acid sequence of a macromolecule

Parameters

protein (Union[str, Mol]) – either an AA sequence or a rdkit.Chem.Mol object that can be converted to FASTA.

Raises
  • TypeError – if the input was none of the above types.

  • ValueError – if the sequence was empty or could not be parsed into FASTA.

Return type

str

Returns

an AA sequence.

get_descriptor(protein)[source]

Convert a macromolecule to a modlamp GlobalDescriptor object.

Parameters

protein (Union[str, Mol]) – either an AA sequence or a rdkit.Chem.Mol object that can be converted to FASTA.

Return type

GlobalDescriptor

Returns

GlobalDescriptor object.

get_target_parameters(target)[source]

Generates a tuple of scorers and weight list

Parameters

target (Union[str, Dict[str, Any]]) – scoring functions and parameters related to it

Return type

Tuple[List[Type[Any]], List[float]]

Returns

A tuple containing scoring functions and weight list

validate_ip(ip, message='')[source]

Validates whether the parameter configuration contains a correct IP address.

Parameters
  • ip (str) – The IP address to validate.

  • message (str) – Additional error message to be displayed.

Return type

None

validate_api_token(parameters, message='')[source]

Validates whether the parameter configuration contains something that _could_ be a valid API key.

Parameters
  • parameters (ApiTokenParameters) – ApiTokenParameters.

  • message (str) – Additional error message to be displayed.

Return type

None

docking_import_check()[source]

Verifies that __some__ of the required packages for docking are installed.

Raises

ModuleNotFoundError – If a necessary module was not found.

Return type

None