OCDocker.Docking.Gnina module¶
Sets of classes and functions that are used to prepare gnina files and run it.
Usage:
import OCDocker.Docking.Gnina as ocgnina
- class OCDocker.Docking.Gnina.Gnina(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, gnina_log, output_gnina, name='', overwrite_config=False)[source]¶
Bases:
objectGnina object with methods for easy run.
- Parameters:
- __init__(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, gnina_log, output_gnina, name='', overwrite_config=False)[source]¶
Constructor of the class Gnina.
- Parameters:
config_path (str) – Path to the configuration file.
box_file (str) – The path for the box file.
receptor (ocr.Receptor) – The receptor object.
prepared_receptor_path (str) – Path to the prepared receptor.
ligand (ocl.Ligand) – The ligand object.
prepared_ligand_path (str) – Path to the prepared ligand.
gnina_log (str) – Path to the gnina log file.
output_gnina (str) – Path to the output gnina file.
name (str, optional) – Name of the gnina object, by default “”.
overwrite_config (bool, optional) – If the config file should be overwritten, by default False.
- Return type:
None
- get_docked_poses()[source]¶
Get the paths for the docked poses.
- Returns:
A list with the paths for the docked poses.
- Return type:
List[str]
- get_input_ligand_path()[source]¶
Get the input ligand path.
- Returns:
The input ligand path.
- Return type:
str
- get_input_receptor_path()[source]¶
Get the input receptor path.
- Returns:
The input receptor path.
- Return type:
str
- read_log(onlyBest=False)[source]¶
Read the gnina log path, returning a dict with data from complexes.
- Parameters:
onlyBest (bool, optional) – If True, only the best pose will be returned. By default False.
- Returns:
A dictionary with the data from the gnina log file.
- Return type:
Dict[int, Dict[str, float]]
- read_rescore_logs(outPath, onlyBest=False)[source]¶
Reads the data from the rescore log files.
- Parameters:
outPath (str) – Path to the output folder where the rescoring logs are located.
onlyBest (bool, optional) – If True, only the best pose will be returned. By default False.
- Returns:
A dictionary with the data from the rescore log files.
- Return type:
Dict[str, float]
- run_prepare_ligand(overwrite=False)[source]¶
Run Open Babel conversion for ligand.
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the stderr of the command.
- Return type:
int | Tuple[int, str]
- Parameters:
overwrite (bool) –
- run_prepare_ligand_from_cmd(logFile='')[source]¶
Run Open Babel conversion for ligand. [DEPRECATED]
- Parameters:
logFile (str) – The path for the log file.
- Return type:
int | str | Tuple[int, str]
- run_prepare_receptor(overwrite=False)[source]¶
Run Open Babel conversion for receptor.
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the stderr of the command.
- Return type:
int | Tuple[int, str]
- Parameters:
overwrite (bool) –
- run_prepare_receptor_from_cmd(logFile='', overwrite=False)[source]¶
Run Open Babel conversion for receptor. [DEPRECATED]
- Parameters:
logFile (str) – The path for the log file.
overwrite (bool) –
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the stderr of the command.
- Return type:
int | Tuple[int, str]
- run_rescore(outPath, ligand, logFile='', skipDefaultScoring=False, splitLigand=False, overwrite=False)[source]¶
Run gnina to rescore the ligand.
- Parameters:
outPath (str) – Path to the output folder.
ligand (str) – Path to the ligand to be rescored.
logFile (str, optional) – Path to the logFile. If empty, suppress the output. By default “”.
skipDefaultScoring (bool, optional) – If True, skip the default scoring function. By default False.
splitLigand (bool, optional) – If True, split the ligand before rescoring. By default False.
overwrite (bool, optional) – If True, overwrite the logFile. By default False.
- Return type:
None
- run_gnina(logFile='', overwrite=False)[source]¶
Run gnina.
- Parameters:
logFile (str) – The path for the extra execution log.
overwrite (bool, optional) – If True, overwrite existing output/log files.
- Returns:
The exit code of the command (based on the Error.py code table).
- Return type:
int | Tuple[int, str]
- split_poses(outPath='', logFile='')[source]¶
Split the ligand resulted from gnina into its poses.
- Parameters:
outPath (str, optional) – Path to the output folder. By default “”. If empty, the poses will be saved in the same folder as the gnina output.
logFile (str, optional) – Path to the logFile. If empty, suppress the output. By default “”.
- Returns:
The exit code of the command (based on the Error.py code table).
- Return type:
int
- OCDocker.Docking.Gnina.gen_gnina_conf(box_file, conf_file, receptor)[source]¶
Convert a box (DUDE like format) to gnina input.
- Parameters:
box_file (str) – The path to the box file.
conf_file (str) – The path for the conf file.
receptor (str) – The path for the receptor.
- Returns:
The exit code of the command (based on the Error.py code table).
- Return type:
int
- OCDocker.Docking.Gnina.get_pose_index_from_file_path(filePath)[source]¶
Get the pose index from the file path.
- Parameters:
filePath (str) – The path to the file.
- Returns:
The pose index.
- Return type:
int
- OCDocker.Docking.Gnina.get_rescore_log_paths(outPath)[source]¶
Get the paths for the rescore log files.
- Parameters:
outPath (str) – Path to the output folder where the rescoring logs are located.
- Returns:
A list with the paths for the rescoring log files.
- Return type:
List[str]
- OCDocker.Docking.Gnina.read_rescore_logs(rescoreLogPaths, onlyBest=False)[source]¶
Reads the data from the rescore log files.
- Parameters:
rescoreLogPaths (List[str] | str) – A list with the paths for the rescoring log files.
onlyBest (bool, optional) – If True, only the best pose will be returned. By default False.
- Returns:
A dictionary with the data from the rescore log files.
- Return type:
Dict[str, float]
- OCDocker.Docking.Gnina.run_prepare_ligand(input_ligand_path, prepared_ligand, overwrite=False)[source]¶
Run Open Babel convert ligand to pdbqt.
- Parameters:
input_ligand_path (str) – The path for the input ligand.
prepared_ligand (str) – The path for the prepared ligand.
overwrite (bool) –
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the output of the command.
- Return type:
int | Tuple[int, str]
- OCDocker.Docking.Gnina.run_prepare_ligand_from_cmd(input_ligand_path, prepared_ligand, log_file='')[source]¶
Converts the ligand to .pdbqt using Open Babel. [DEPRECATED]
- Parameters:
input_ligand_path (str) – The path for the input ligand.
prepared_ligand (str) – The path for the prepared ligand.
log_file (str) – The path for the log file.
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the output of the command.
- Return type:
int | Tuple[int, str]
- OCDocker.Docking.Gnina.run_prepare_receptor(input_receptor_path, prepared_receptor, overwrite=False)[source]¶
Run Open Babel convert receptor to pdbqt.
- Parameters:
input_receptor_path (str) – The path for the input receptor.
prepared_receptor (str) – The path for the prepared receptor.
overwrite (bool) –
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the output of the command.
- Return type:
int | Tuple[int, str]
- OCDocker.Docking.Gnina.run_prepare_receptor_from_cmd(input_receptor_path, output_receptor, log_file='')[source]¶
Converts the receptor to .pdbqt using Open Babel. [DEPRECATED]
- Parameters:
input_receptor_path (str) – The path for the input receptor.
output_receptor (str) – The path for the output receptor.
log_file (str) – The path for the log file.
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the output of the command.
- Return type:
int | Tuple[int, str]
- OCDocker.Docking.Gnina.run_gnina(config, prepared_ligand, output_gnina, gnina_log, log_path)[source]¶
Run gnina.
- Parameters:
config (str) – The path for the config file.
prepared_ligand (str) – The path for the prepared ligand.
output_gnina (str) – The path for the output gnina file.
gnina_log (str) – The path for the gnina log file.
log_path (str) – The path for the execution log file.
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the output of the command.
- Return type:
int | Tuple[int, str]
- OCDocker.Docking.Gnina.run_rescore(confFile, ligands, outPath, scoring_function, logFile='', splitLigand=True, overwrite=False, cnn_model='', disable_cnn=False)[source]¶
Run gnina to rescore the ligand.
- Parameters:
confFile (str) – The path to the gnina configuration file.
ligands (Union[List[str], str]) – The path to a List of ligand files or the ligand file.
outPath (str) – The path to the output file.
scoring_function (str) – The scoring function to use.
logFile (str, optional) – The path to the log file. If empty, suppress the output. By default “”.
splitLigand (bool, optional) – If True, split the ligand before running gnina. By default True.
overwrite (bool, optional) – If True, overwrite the logFile. By default False.
cnn_model (str, optional) – Built-in CNN model to evaluate (via –cnn). By default “”.
disable_cnn (bool, optional) – If True, force empirical-only scoring with –cnn_scoring none. By default False.
- Return type:
None
- OCDocker.Docking.Gnina.run_docking(config, prepared_ligand, output_gnina, gnina_log, log_path)¶
Run gnina.
- Parameters:
config (str) – The path for the config file.
prepared_ligand (str) – The path for the prepared ligand.
output_gnina (str) – The path for the output gnina file.
gnina_log (str) – The path for the gnina log file.
log_path (str) – The path for the execution log file.
- Returns:
The exit code of the command (based on the Error.py code table) or a tuple with the exit code and the output of the command.
- Return type:
int | Tuple[int, str]