OCDocker.Docking.Vina module¶
Sets of classes and functions that are used to prepare vina files and run it.
Usage:
import OCDocker.Docking.Vina as ocvina
- class OCDocker.Docking.Vina.Vina(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, vina_log, output_vina, name='', overwrite_config=False)[source]¶
Bases:
objectVina object with methods for easy run.
- Parameters:
- __init__(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, vina_log, output_vina, name='', overwrite_config=False)[source]¶
Constructor of the class Vina.
- Parameters:
config_path (str) – The path for the config file.
box_file (str) – The path for the box file.
receptor (ocr.Receptor) – The receptor object.
prepared_receptor_path (str) – The path for the prepared receptor.
ligand (ocl.Ligand) – The ligand object.
prepared_ligand_path (str) – The path for the prepared ligand.
vina_log (str) – The path for the vina log file.
output_vina (str) – The path for the vina output files.
name (str, optional) – The name of the vina object, by default “”.
overwrite_config (bool, optional) – If True, overwrite the config file if it already exists, 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 vina 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 vina log file. If any error occurs, it will return the exit code of the command (based on the Error.py code table).
- Return type:
Dict[int, Dict[str, float]] | int
- 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(logFile='', useOpenBabel=False, overwrite=False)[source]¶
Run ‘prepare_ligand4’ or openbabel to prepare the ligand.
- Parameters:
logFile (str) – Path to the logFile. If empty, suppress the output.
useOpenBabel (bool) – If True, use openbabel instead of prepare_ligand4.
overwrite (bool) – If True, overwrite existing output file.
- 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. If fails, return the file extension.
- Return type:
int | str | Tuple[int, str]
- run_prepare_receptor(logFile='', useOpenBabel=False, overwrite=False)[source]¶
Run ‘prepare_receptor4’ or openbabel to prepare the receptor.
- Parameters:
logFile (str) – Path to the logFile. If empty, suppress the output.
useOpenBabel (bool) – If True, use openbabel instead of prepare_receptor4.
overwrite (bool) – If True, overwrite the prepared receptor file.
- 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. If fails, return the file extension.
- Return type:
int | str | Tuple[int, str]
- run_rescore(outPath, ligand, logFile='', skipDefaultScoring=False, splitLigand=False, overwrite=False)[source]¶
Run vina to rescore the ligand.
- Parameters:
outPath (str) – Path to the output folder.
ligand (str) – Path to the ligand file.
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 running vina. By default False.
overwrite (bool, optional) – If True, overwrite the logFile. By default False.
- Return type:
None
- run_vina(overwrite=False)[source]¶
Run vina.
- Parameters:
overwrite (bool, optional) – If True, overwrite existing output/log files.
- Return type:
int | Tuple[int, str]
- split_poses(outPath='', logFile='')[source]¶
Split the ligand resulted from vina 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 vina 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.Vina.box_to_vina(box_file, conf_file, receptor)[source]¶
Convert a box (DUDE like format) to vina input.
- Parameters:
box_file (str) – The path to the box file.
conf_file (str) – The path to the vina configuration file.
receptor (str) – The path to the receptor file.
- Return type:
int
- OCDocker.Docking.Vina.generate_vina_files_database(path, protein, boxPath='')[source]¶
Generate all vina required files for provided protein.
- Parameters:
path (str) – The path to the folder where the files will be generated.
protein (str) – The path of the protein.
boxPath (str) – The path to the box file. If empty, it will set as path + “/boxes”
- Return type:
None
- OCDocker.Docking.Vina.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.Vina.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.Vina.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, List[Union[str, float]]]
- OCDocker.Docking.Vina.run_prepare_ligand(inputLigandPath, outputLigand, logFile='', overwrite=False)[source]¶
Prepares the ligand using ‘prepare_ligand’ from MGLTools suite.
- Parameters:
inputLigandPath (str) – The path to the input ligand.
outputLigand (str) – The path to the output ligand.
logFile (str) – The path to the log file. If empty, suppress the output.
overwrite (bool) –
- Return type:
int | str | Tuple[int, str]
- OCDocker.Docking.Vina.run_prepare_receptor(inputReceptorPath, outputReceptor, logFile='', overwrite=False)[source]¶
Convert a box (DUDE like format) to vina input.
- Parameters:
inputReceptorPath (str) – The path to the input receptor file.
outputReceptor (str) – The path to the output receptor file.
logFile (str) – The path to the log file. If empty, suppress the output.
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]
- OCDocker.Docking.Vina.run_rescore(confFile, ligands, outPath, scoring_function, logFile='', splitLigand=True, overwrite=False)[source]¶
Run vina to rescore the ligand.
- Parameters:
confFile (str) – The path to the vina 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 vina. By default True.
overwrite (bool, optional) – If True, overwrite the logFile. By default False.
- Return type:
None
- OCDocker.Docking.Vina.run_vina(confFile, ligand, outPath, logFile='')[source]¶
Run vina.
- Parameters:
confFile (str) – The path to the vina configuration file.
ligand (str) – The path to the ligand file.
outPath (str) – The path to the output file.
logFile (str) – The path to the log file. If empty, suppress the output.
- Returns:
The exit code of the command (based on the Error.py code table).
- Return type:
int