OCDocker.Docking.PLANTS module

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

Usage:

import OCDocker.Docking.PLANTS as ocplants

class OCDocker.Docking.PLANTS.PLANTS(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, plants_log, output_plants, name='', box_spacing=2.9, overwrite_config=False)[source]

Bases: object

PLANTS 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) –

  • plants_log (str) –

  • output_plants (str) –

  • name (str) –

  • box_spacing (float) –

  • overwrite_config (bool) –

__init__(config_path, box_file, receptor, prepared_receptor_path, ligand, prepared_ligand_path, plants_log, output_plants, name='', box_spacing=2.9, overwrite_config=False)[source]

Constructor for the PLANTS object.

Parameters:
  • config_path (str) – Path for the PLANTS config file.

  • box_file (str) – Path for the PLANTS box file.

  • receptor (ocr.Receptor) – Receptor object.

  • prepared_receptor_path (str) – Path for the prepared receptor.

  • ligand (ocl.Ligand) – Ligand object.

  • prepared_ligand_path (str) – Path for the prepared ligand.

  • plants_log (str) – Path for the PLANTS log file.

  • output_plants (str) – Path for the PLANTS output file.

  • name (str, optional) – Name for the PLANTS run, by default “”

  • box_spacing (float, optional) – Spacing for the PLANTS box, by default 0.33.

  • overwrite_config (bool, optional) – Overwrite the PLANTS config file, 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

get_rescore_log_paths(onlyBest=False)[source]

Get the paths for the rescore csv file.

Parameters:

onlyBest (bool, optional) – If True, only the best pose will be returned. By default False.

Returns:

List of rescoring logs.

Return type:

List[str]

print_attributes()[source]

Print the class attributes.

Return type:

None

read_log(onlyBest=True)[source]

Read the PLANTS log path, returning a pd.dataframe with data from complexes.

Parameters:

onlyBest (bool, optional) – If True, only the best pose will be returned. By default True.

Returns:

The dictionary with the data from complexes.

Return type:

Dict[int, Dict[str, float]]

read_rescore_logs(onlyBest=False)[source]

Reads the data from the rescore log files.

Parameters:

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, Dict[str, float]]

run_plants(overwrite=False)[source]

Run plants.

Parameters:

overwrite (bool, optional) – If True, overwrite the output file. Default is False.

Returns:

The exit code of the command (based on the Error.py code table) and the stderr if applied.

Return type:

Tuple[int, str] | int

run_prepare_ligand(logFile='', overwrite=False)[source]

Run SPORES for ligand.

Parameters:
  • logFile (str, optional) – The path for the log file. Default is “”.

  • overwrite (bool, optional) – Whether to overwrite existing output file (default is False).

Returns:

The exit code of the command (based on the Error.py code table) and the stderr if applied.

Return type:

Tuple[int, str] | int

run_prepare_receptor(logFile='', overwrite=False)[source]

Run SPORES for receptor.

Parameters:
  • logFile (str, optional) – The path for the log file. Default is “”.

  • overwrite (bool, optional) – Whether to overwrite existing output file (default is False).

Returns:

The exit code of the command (based on the Error.py code table) and the stderr if applied.

Return type:

Tuple[int, str] | int

run_rescore(pose_list, logFile='', skipDefaultScoring=False, overwrite=False)[source]

Run PLANTS to rescore the ligand.

Parameters:
  • pose_list (str) – The path to the ligand poses list file.

  • logFile (str) – Path to the logFile. If empty, suppress the output.

  • skipDefaultScoring (bool, optional) – If True, skip the default scoring function. By default False.

  • overwrite (bool, optional) – If True, overwrite the logFile. Default is False.

Return type:

None

write_config_file()[source]

Write the config file.

Returns:

The exit code of the command (based on the Error.py code table).

Return type:

int

write_pose_list(overwrite=False)[source]

Write the pose_list file.

Parameters:

overwrite (bool, optional) – If True, overwrite the pose_list file. Default is False.

Returns:

The path for the pose_list file. If the file already exists and overwrite is False, return None.

Return type:

str | None

OCDocker.Docking.PLANTS.box_to_plants(box_file, conf_file, receptor, ligand, output_plants, center=None, binding_site_radius=None, spacing=2.9)[source]

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

Parameters:
  • box_file (str) – The path to the box file.

  • conf_file (str) – The path to the PLANTS configuration file.

  • receptor (str) – The path to the receptor file.

  • ligand (str) – The path to the ligand file.

  • output_plants (str) – The path to the PLANTS output directory.

  • center (float, optional) – The center of the box. Default is None and it will be calculated.

  • binding_site_radius (float, optional) – The radius of the box. Default is None and it will be calculated.

  • spacing (float, optional) – The spacing between the grid points. Default is 2.9.

Return type:

int

OCDocker.Docking.PLANTS.generate_digest(digestPath, logPath, overwrite=False, digestFormat='json', box_id=None)[source]

Generate the docking digest.

Parameters:
  • digestPath (str) – Where to store the digest file.

  • logPath (str) – The log path.

  • overwrite (bool, optional) – If True, overwrites the output files if they already exist. (default is False)

  • digestFormat (str, optional) – The format of the digest file. The options are: [ json (default), hdf5 (not implemented) ]

  • box_id (str | None) –

Returns:

The exit code of the command (based on the Error.py code table).

Return type:

int

OCDocker.Docking.PLANTS.generate_plants_files_database(path, protein, ligand, spacing=0.33, boxPath='')[source]

Generate all PLANTS required files for provided protein.

Parameters:
  • path (str) – The path to the directory where the files will be generated.

  • protein (str) – The path to the protein file.

  • ligand (str) – The path to the ligand file.

  • spacing (float) – The spacing between the box and the binding site.

  • boxPath (str, optional) – The path to the box file. If empty, it will set as path + “/boxes”

Return type:

None

OCDocker.Docking.PLANTS.get_binding_site(boxFile, spacing=2.9)[source]

Get the binding site from a box file.

Parameters:
  • boxFile (str) – The path to the box file.

  • spacing (float, optional) – The spacing between the box and the binding site. Default is 2.9.

Returns:

The center of the binding site and the radius of the binding site. If there is an error, the error code is returned.

Return type:

Tuple[Tuple[float, float, float], float] | int

OCDocker.Docking.PLANTS.get_docked_poses(posesPath)[source]

Get the docked poses from the poses path.

Parameters:

posesPath (str) – The path to the poses folder.

Returns:

A list with the paths to the docked poses.

Return type:

List[str]

OCDocker.Docking.PLANTS.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.PLANTS.read_log(path, onlyBest=False)[source]

Read the PLANTS log path, returning a dict with data from complexes.

Parameters:
  • path (str) – The path to the PLANTS log file.

  • onlyBest (bool, optional) – If True, only the best pose will be returned. By default False.

Returns:

A dictionary with the data from the PLANTS log file.

Return type:

Dict[int, Dict[str, Union[float, List[float]]]]

OCDocker.Docking.PLANTS.run_plants(confFile, outputPlants, overwrite=False, logFile='')[source]

Run PLANTS.

Parameters:
  • confFile (str) – The path to the PLANTS configuration file.

  • outputPlants (str) – The path to the PLANTS output directory.

  • overwrite (bool, optional) – If True, overwrite the output directory. Default is False.

  • logFile (str, optional) – The path for the log file. Default is “”.

Returns:

The exit code of the command (based on the Error.py code table) and the stderr if applied.

Return type:

Tuple[int, str] | int

OCDocker.Docking.PLANTS.run_prepare_ligand(input_ligand_path, output_ligand, log_file='', overwrite=False)[source]

Run SPORES for ligand.

Parameters:
  • input_ligand_path (str) – The path to the input ligand.

  • output_ligand (str) – The path to the output ligand.

  • log_file (str, optional) – The path for the log file. Default is “”.

  • overwrite (bool) –

Returns:

The exit code of the command (based on the Error.py code table) and the stderr if applied.

Return type:

Tuple[int, str] | int

OCDocker.Docking.PLANTS.run_prepare_receptor(input_receptor_path, output_receptor, log_file='', overwrite=False)[source]

Run SPORES for receptor.

Parameters:
  • input_receptor_path (str) – The path to the input receptor.

  • output_receptor (str) – The path to the output receptor.

  • log_file (str, optional) – The path for the log file. Default is “”.

  • overwrite (bool) –

Returns:

The exit code of the command (based on the Error.py code table) and the stderr if applied.

Return type:

Tuple[int, str] | int

OCDocker.Docking.PLANTS.run_rescore(confFile, pose_list_file, outPath, proteinFile, scoring_function, bindingSiteCenterX, bindingSiteCenterY, bindingSiteCenterZ, bindingSiteRadius, logFile='', overwrite=False)[source]

Run PLANTS to rescore the ligand.

Parameters:
  • confFile (str) – The path to the PLANTS configuration file.

  • pose_list_file (str) – The path to the ligand poses list file.

  • outPath (str) – The path to the output file.

  • proteinFile (str) – The path to the protein file which will be used as receptor.

  • scoring_function (str) – The scoring function to use.

  • bindingSiteCenterX (float) – The X coordinate of the binding site center.

  • bindingSiteCenterY (float) – The Y coordinate of the binding site center.

  • bindingSiteCenterZ (float) – The Z coordinate of the binding site center.

  • bindingSiteRadius (float) – The radius of the binding site.

  • logFile (str) – The path to the log file. If empty, suppress the output.

  • overwrite (bool, optional) – If True, overwrite the logFile. Default is False.

Returns:

The exit code of the command (based on the Error.py code table).

Return type:

int

OCDocker.Docking.PLANTS.write_config_file(confFile, preparedReceptor, preparedLigand, outputPlants, bindingSiteCenterX, bindingSiteCenterY, bindingSiteCenterZ, bindingSiteRadius, scoringFunction='chemplp')[source]

Write the config file.

Parameters:
  • confFile (str) – The path to the PLANTS configuration file.

  • preparedReceptor (str) – The path to the prepared receptor.

  • preparedLigand (str) – The path to the prepared ligand.

  • outputPlants (str) – The path to the PLANTS output directory.

  • bindingSiteCenterX (float) – The X coordinate of the binding site center.

  • bindingSiteCenterY (float) – The Y coordinate of the binding site center.

  • bindingSiteCenterZ (float) – The Z coordinate of the binding site center.

  • bindingSiteRadius (float) – The radius of the binding site.

  • scoringFunction (str, optional) – The scoring function to use. Default is “chemplp”. Options are plp, plp95 or chemplp

Returns:

The exit code of the command (based on the Error.py code table).

Return type:

int

OCDocker.Docking.PLANTS.write_pose_list(dockedPoses, poseListPath, overwrite=False)[source]

Write the pose_list file.

Parameters:
  • dockedPoses (Union[str, List[str]]) –

  • provided (The list with the docked poses. If a string is) –

  • pose. (it will be considered as a single) –

  • poseListPath (str) –

  • overwrite (bool) –

Return type:

str | None

poseListPathstr

The path to the pose_list file.

overwritebool, optional

If True, overwrite the pose_list file. Default is False.

Returns:

The path for the pose_list file. If the file already exists and overwrite is False, return None.

Return type:

str | None

Parameters:
  • dockedPoses (str | List[str]) –

  • poseListPath (str) –

  • overwrite (bool) –

OCDocker.Docking.PLANTS.write_rescoring_config_file(confFile, preparedReceptor, ligandListPath, outputPlants, bindingSiteCenterX, bindingSiteCenterY, bindingSiteCenterZ, bindingSiteRadius, scoringFunction='chemplp', rescoringMode='simplex')[source]

Write the config file to be used in rescoring mode.

Parameters:
  • confFile (str) – The path to the PLANTS configuration file.

  • preparedReceptor (str) – The path to the prepared receptor.

  • ligandListPath (str) – The path to the ligand pose_list file.

  • outputPlants (str) – The path to the PLANTS output directory.

  • bindingSiteCenterX (float) – The X coordinate of the binding site center.

  • bindingSiteCenterY (float) – The Y coordinate of the binding site center.

  • bindingSiteCenterZ (float) – The Z coordinate of the binding site center.

  • bindingSiteRadius (float) – The radius of the binding site.

  • scoringFunction (str, optional) – The scoring function to use. Default is “chemplp”. Options are plp, plp95 or chemplp

  • rescoringMode (str, optional) – The rescoring mode to use. Default is “simplex”. Options are simplex or no_simplex.

Returns:

The exit code of the command (based on the Error.py code table).

Return type:

int

OCDocker.Docking.PLANTS.run_docking(confFile, outputPlants, overwrite=False, logFile='')

Run PLANTS.

Parameters:
  • confFile (str) – The path to the PLANTS configuration file.

  • outputPlants (str) – The path to the PLANTS output directory.

  • overwrite (bool, optional) – If True, overwrite the output directory. Default is False.

  • logFile (str, optional) – The path for the log file. Default is “”.

Returns:

The exit code of the command (based on the Error.py code table) and the stderr if applied.

Return type:

Tuple[int, str] | int

OCDocker.Docking.PLANTS.read_rescore_logs(path, onlyBest=False)

Read the PLANTS log path, returning a dict with data from complexes.

Parameters:
  • path (str) – The path to the PLANTS log file.

  • onlyBest (bool, optional) – If True, only the best pose will be returned. By default False.

Returns:

A dictionary with the data from the PLANTS log file.

Return type:

Dict[int, Dict[str, Union[float, List[float]]]]