OCDocker.Toolbox.Conversion module¶
Sets of classes and functions that are used to convert informations such as molecules.
Usage:
import OCDocker.Toolbox.Conversion as occonversion
- OCDocker.Toolbox.Conversion.convert_mols(input_file: str, output_file: str, return_molecule: Literal[True], overwrite: bool = False) int | rdkit.Chem.rdchem.Mol | _OBMol[source]¶
- OCDocker.Toolbox.Conversion.convert_mols(input_file: str, output_file: str, return_molecule: Literal[False] = False, overwrite: bool = False) int | str
Convert a molecule file between two extensions which obabel supports.
- Parameters:
input_file (str) – Input file path.
output_file (str) – Output file path.
return_molecule (bool) – If True, returns the molecule object. (default is False)
overwrite (bool, optional) – If True, overwrites the output file if it already exists. (default is False)
- Returns:
The exit code of the command (based on the Error.py code table) if fails or the extension of the input file otherwise.
- Return type:
int | str | rdkit.Chem.rdchem.Mol
- OCDocker.Toolbox.Conversion.convert_mols_from_string(input, output, mol=None, overwrite=False)[source]¶
Currently only works with smiles. TODO: Add support to other formats.
- Parameters:
input (str) – Input file content as string.
output (str) – Output file name.
mol (rdkit.Chem.rdchem.Mol | None, optional) – The molecule object to be used to convert the input string to a file. If None, it will be created. (default is None)
overwrite (bool) –
- Returns:
The exit code of the command (based on the Error.py code table) if fails or the extension of the input file otherwise returns the extension itself.
- Return type:
int | str
- OCDocker.Toolbox.Conversion.kikd_to_deltag(kikd, T=298.15, kikd_order='un', R=8.314462618)[source]¶
Converts Ki/Kd to deltaG.
- Parameters:
kikd (float) – Ki/Kd value.
T (float, optional) – Temperature in Kelvin. (default is STANDARD_TEMPERATURE_K, 298.15 K)
kikd_order (str, optional) – Order of the Ki/Kd value. (default is “un”)
R (float, optional) – Ideal gas constant in J/(mol·K). (default is RJ, 8.314462618 J/(mol·K))
- Returns:
The deltaG value.
- Return type:
float
- OCDocker.Toolbox.Conversion.split_and_convert(path, out_path, extension, overwrite=False)[source]¶
Splits a multi-molecule file then save the output in multiple single-molecule file with the desired extension. (Supported by openbabel)
- Parameters:
path (str) – Path to the multi-molecule file.
out_path (str) – Path to the output folder.
extension (str) – Extension of the output files.
overwrite (bool, optional) – If True, overwrites the output files if they already exist. (default is False)
- Returns:
The exit code of the command (based on the Error.py code table).
- Return type:
int