OCDocker.Toolbox.MoleculeProcessing module

Sets of classes and functions that are used to extract and process information of any kind of molecule.

Usage:

import OCDocker.Toolbox.MoleculeProcessing as ocmolproc

OCDocker.Toolbox.MoleculeProcessing.build_charmm_to_canonical_map()[source]

Build a complete CHARMM -> canonical mapping using PDB2PQR definitions and the CHARMM forcefield naming rules.

Returns:

The mapping from CHARMM (key) to canonical (value).

Return type:

Dict[AtomKey, AtomVal]

OCDocker.Toolbox.MoleculeProcessing.clean_for_dssp(structurePath)[source]

Make a pdb file with HEADER (empty), then CRYST1 and finally ATOM records only.

Parameters:

structurePath (str) – The path to the structure file.

Returns:

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

Return type:

int

OCDocker.Toolbox.MoleculeProcessing.clean_pdb_file(structurePath, outputPath, overwrite=False, keep_hetatm=False)[source]

Create a cleaned PDB file with HEADER, CRYST1, and ATOM (optionally HETATM) records.

Parameters:
  • structurePath (str) – The path to the input structure file.

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

  • overwrite (bool, optional) – If True, overwrites the output file when it already exists.

  • keep_hetatm (bool, optional) – If True, keep HETATM lines in the output.

Returns:

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

Return type:

int

OCDocker.Toolbox.MoleculeProcessing.convert_pdb_charmm_to_canonical(pdb_in, pdb_out, *, collapse_resnames=True, overwrite=False, in_place=False)[source]

Convert a CHARMM-named PDB to canonical PDB names using PDB2PQR mappings.

Parameters:
  • pdb_in (str | os.PathLike) – Input PDB file.

  • pdb_out (str | os.PathLike) – Output PDB file (ignored if in_place=True).

  • collapse_resnames (bool, optional) – Collapse patched/protonated residue names to common PDB names.

  • overwrite (bool, optional) – Whether to overwrite output file when in_place=False.

  • in_place (bool, optional) – If True, overwrite the input file path atomically.

Return type:

int

OCDocker.Toolbox.MoleculeProcessing.get_rmsd(reference, molecule)[source]

Get the rmsd between a reference and a molecule file (it supports more than one molecule in this second file).

Parameters:
  • reference (str) – The reference file.

  • molecule (str) – The molecule file.

Returns:

The rmsd between the reference and the molecule file.

Return type:

List[float] | float

OCDocker.Toolbox.MoleculeProcessing.get_rmsd_matrix(molecules)[source]

Get the rmsd matrix between a list of molecules.

Parameters:

molecules (List[str]) – The list of molecules.

Returns:

The rmsd matrix.

Return type:

Dict[str, Dict[str, float]]

OCDocker.Toolbox.MoleculeProcessing.needs_canonical_pdb_fix(pdb_path, *, collapse_resnames=True)[source]

Check if a PDB file contains CHARMM-style names that should be canonicalized.

Parameters:
  • pdb_path (str | PathLike) –

  • collapse_resnames (bool) –

Return type:

bool

OCDocker.Toolbox.MoleculeProcessing.split_poses(ligand, ligandName, outPath, suffix='', logFile='')[source]

Split the input ligand into its poses.

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

  • ligandName (str) – The name of the input ligand.

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

  • suffix (str, optional) – The suffix to be added to the output files, by default “”.

  • logFile (str, optional) – The path to the log file, by default “”.

Returns:

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

Return type:

int