OCDocker.Docking.Smina module

Sets of classes and functions that are used to prepare smina files and run it.

Usage:

import OCDocker.Docking.Smina as ocsmina

class OCDocker.Docking.Smina.Smina(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, smina_log, output_smina, name='', overwrite_config=False)[source]

Bases: object

Smina object with methods for easy run.

Parameters:
  • config_path (str) –

  • box_file (str) –

  • receptor (Receptor) –

  • prepared_receptor_path (str) –

  • ligand (Ligand) –

  • prepared_ligand_path (str) –

  • smina_log (str) –

  • output_smina (str) –

  • name (str) –

  • overwrite_config (bool) –

__init__(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, smina_log, output_smina, name='', overwrite_config=False)[source]

Constructor of the class Smina.

Parameters:
  • configPath (str) – Path to the configuration file.

  • boxFile (str) – The path for the box file.

  • receptor (ocr.Receptor) – The receptor object.

  • preparedReceptorPath (str) – Path to the prepared receptor.

  • ligand (ocl.Ligand) – The ligand object.

  • preparedLigandPath (str) – Path to the prepared ligand.

  • sminaLog (str) – Path to the smina log file.

  • outputSmina (str) – Path to the output smina file.

  • name (str, optional) – Name of the smina object, by default “”.

  • overwrite_config (bool, optional) – If the config file should be overwritten, by default False.

  • config_path (str) –

  • box_file (str) –

  • prepared_receptor_path (str) –

  • prepared_ligand_path (str) –

  • smina_log (str) –

  • output_smina (str) –

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

print_attributes()[source]

Print the class attributes.

Return type:

None

read_log(onlyBest=False)[source]

Read the SMINA 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 SMINA 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]]

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 the convert ligand command to pdbqt.

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 obabel convert ligand to pdbqt using the ‘self.inputLigandPath’ attribute. [DEPRECATED]

Parameters:

logFile (str) – The path for the log file.

Return type:

int | str | Tuple[int, str]

run_prepare_receptor(overwrite=False)[source]

Run obabel convert receptor to pdbqt using the openbabel python library.

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 obabel convert receptor to pdbqt script using the ‘self.prepareReceptorCmd’ attribute. [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 smina 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_smina(logFile='', overwrite=False)[source]

Run smina.

Parameters:
  • logFile (str) – The path for the log file.

  • 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 smina 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.Smina.gen_smina_conf(box_file, conf_file, receptor)[source]

Convert a box (DUDE like format) to smina 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.

Return type:

int

OCDocker.Docking.Smina.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.Smina.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.Smina.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.Smina.run_prepare_ligand(input_ligand_path, prepared_ligand, overwrite=False)[source]

Run obabel convert ligand to pdbqt using the openbabel python library.

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.Smina.run_prepare_ligand_from_cmd(input_ligand_path, prepared_ligand, log_file='')[source]

Converts the ligand to .pdbqt using obabel. [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.Smina.run_prepare_receptor(input_receptor_path, prepared_receptor, overwrite=False)[source]

Run obabel convert receptor to pdbqt using the openbabel python library.

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.Smina.run_prepare_receptor_from_cmd(input_receptor_path, output_receptor, log_file='')[source]

Converts the receptor to .pdbqt using obabel. [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.Smina.run_rescore(confFile, ligands, outPath, scoring_function, logFile='', splitLigand=True, overwrite=False)[source]

Run smina to rescore the ligand.

Parameters:
  • confFile (str) – The path to the smina 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 smina. By default True.

  • overwrite (bool, optional) – If True, overwrite the logFile. By default False.

Return type:

None

OCDocker.Docking.Smina.run_smina(config, prepared_ligand, output_smina, smina_log, log_path)[source]

Convert a box (DUDE like format) to smina input.

Parameters:
  • config (str) – The path for the config file.

  • prepared_ligand (str) – The path for the prepared ligand.

  • output_smina (str) – The path for the output smina file.

  • smina_log (str) – The path for the smina log file.

  • log_path (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.Smina.run_docking(config, prepared_ligand, output_smina, smina_log, log_path)

Convert a box (DUDE like format) to smina input.

Parameters:
  • config (str) – The path for the config file.

  • prepared_ligand (str) – The path for the prepared ligand.

  • output_smina (str) – The path for the output smina file.

  • smina_log (str) – The path for the smina log file.

  • log_path (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]