OCDocker.Pocket module

Sets of classes and functions that are used to process all content related to the binding pocket of a receptor.

A pocket is defined by a reference ligand: every standard receptor residue with at least one heavy atom within a distance cutoff of any reference-ligand heavy atom belongs to the pocket. One receptor may hold several pockets, each built from its own reference ligand.

Usage:

import OCDocker.Pocket as ocpocket

class OCDocker.Pocket.Pocket(structure, reference_ligand, name, cutoff=8.0, ph=7.4, gravy_scale='KyteDoolitle', from_json_descriptors='', overwrite=False, clean=False, canonicalize_pdb='auto')[source]

Bases: object

Represents a receptor binding pocket defined by a reference ligand.

The pocket is the set of standard receptor residues with at least one heavy atom within cutoff angstroms of any heavy atom of the reference ligand. Descriptors are computed on those residues only: residue counts, number of chains contributing, solvent accessible surface area in the context of the full receptor, GRAVY, aromaticity, side-chain net charge and side-chain hydrogen-bond donor and acceptor atoms lining the pocket.

Parameters:
  • structure (str | Bio.PDB.Structure.Structure) – Path to a PDB/mmCIF file or a BioPython Structure object of the receptor.

  • reference_ligand (str | rdkit.Chem.rdchem.Mol) – Path to the reference ligand (pdb/sdf/mol/mol2) or an RDKit Mol with 3D coordinates. Not required when from_json_descriptors is given.

  • name (str) – Name identifier for the pocket.

  • cutoff (float, optional) – Heavy-atom distance cutoff in angstroms defining the pocket, by default 8.0.

  • ph (float, optional) – pH used to compute the side-chain net charge, by default 7.4.

  • gravy_scale (str, optional) – GRAVY scale to use, by default “KyteDoolitle”.

  • from_json_descriptors (str, optional) – Path to JSON file containing pre-computed descriptors, by default “”.

  • overwrite (bool, optional) – Whether to overwrite existing files, by default False.

  • clean (bool, optional) – Whether the receptor pdb file will be cleaned, by default False.

  • canonicalize_pdb (bool | str, optional) – Whether to canonicalize CHARMM-style PDB atom/residue names. Use True, False, or "auto", by default "auto".

name

Name of the pocket.

Type:

str

path

Path to the receptor structure file.

Type:

str

reference_ligand_path

Path to the reference ligand used to define the pocket.

Type:

str

structure

BioPython structure object of the receptor.

Type:

Bio.PDB.Structure.Structure

residues

One-letter sequence of the pocket residues, in structure order.

Type:

str

residue_ids

Pocket residues as chain:number:insertion:resname identifiers.

Type:

list[str]

cutoff

Heavy-atom distance cutoff in angstroms.

Type:

float

SASA

Solvent accessible surface area of the pocket residues, computed in the context of the full receptor.

Type:

float

GRAVY

Grand average of hydropathy of the pocket residues.

Type:

float

Aromaticity

Aromaticity index of the pocket residues.

Type:

float

NetCharge

Side-chain net charge of the pocket residues at ph.

Type:

float

countA, countR, countN, ..., countV

Count of each amino acid type among the pocket residues. Unlike OCDocker.Receptor.Receptor, where these count only surface residues, here every pocket residue is counted.

Type:

int

TotalAALength

Number of pocket residues.

Type:

int

countChain

Number of chains contributing residues to the pocket.

Type:

int

countHBondDonors

Side-chain hydrogen-bond donor atoms within cutoff of the reference ligand.

Type:

int

countHBondAcceptors

Side-chain hydrogen-bond acceptor atoms within cutoff of the reference ligand.

Type:

int

descriptors_names = {'count': ['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V']}
single_descriptors = ['TotalAALength', 'countChain', 'SASA', 'GRAVY', 'Aromaticity', 'NetCharge', 'countHBondDonors', 'countHBondAcceptors']
allDescriptors = ['countA', 'countR', 'countN', 'countD', 'countC', 'countQ', 'countE', 'countG', 'countH', 'countI', 'countL', 'countK', 'countM', 'countF', 'countP', 'countS', 'countT', 'countW', 'countY', 'countV', 'TotalAALength', 'countChain', 'SASA', 'GRAVY', 'Aromaticity', 'NetCharge', 'countHBondDonors', 'countHBondAcceptors']
__init__(structure, reference_ligand, name, cutoff=8.0, ph=7.4, gravy_scale='KyteDoolitle', from_json_descriptors='', overwrite=False, clean=False, canonicalize_pdb='auto')[source]

Constructor of the class Pocket.

Parameters:
  • structure (str | Bio.PDB.Structure.Structure) – Path to the receptor structure file OR Bio.PDB.Structure.Structure object.

  • reference_ligand (str | rdkit.Chem.rdchem.Mol) – Path to the reference ligand OR RDKit Mol with 3D coordinates.

  • name (str) – Name of the pocket.

  • cutoff (float, optional) – Heavy-atom distance cutoff in angstroms defining the pocket, by default 8.0.

  • ph (float, optional) – pH used to compute the side-chain net charge, by default 7.4.

  • gravy_scale (str, optional) – Scale to be used to compute the GRAVY descriptor, by default “KyteDoolitle”.

  • from_json_descriptors (str, optional) – Path to the json file containing the descriptors, by default “”.

  • overwrite (bool, optional) – Flag to denote if files will be overwritten, by default False.

  • clean (bool, optional) – Flag to denote if the receptor pdb file will be cleaned, by default False.

  • canonicalize_pdb (bool | str, optional) – Whether to canonicalize CHARMM-style PDB names. Use True, False, or "auto", by default "auto".

Return type:

None

get_descriptors()[source]

Return the descriptors for the Pocket object.

Parameters:

None

Returns:

The descriptors for the Pocket object.

Return type:

Dict[str, float | int | None]

is_valid()[source]

Check if a Pocket object is valid.

Parameters:

None

Returns:

True if the Pocket object is valid, False otherwise.

Return type:

bool

print_attributes()[source]

Print all attributes of the pocket to stdout.

Displays the pocket’s name, receptor and reference ligand paths, cutoff and all computed descriptors in a formatted table.

Return type:

None

to_dict()[source]

Return all the properties for the Pocket object.

Parameters:

None

Returns:

The properties for the Pocket object.

Return type:

Dict[str, float | int]

to_json(overwrite=False)[source]

Stores the descriptors as json to avoid the necessity of evaluate them many times.

Parameters:

overwrite (bool, optional) – If True, the json file will be overwritten if it already exists. Default is False.

Returns:

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

Return type:

int

OCDocker.Pocket.compute_net_charge(residues, ph=7.4)[source]

Compute the side-chain net charge of a set of residues at a given pH.

Uses the Henderson-Hasselbalch equation with the side-chain pKa values from Biopython’s IsoelectricPoint module. Chain termini are not included because pocket residues are not a contiguous chain.

Parameters:
  • residues (str) – The one-letter residues of the pocket.

  • ph (float, optional) – The pH, by default 7.4.

Returns:

The side-chain net charge.

Return type:

float

OCDocker.Pocket.compute_pocket_sasa(structure, residues, n_points=100)[source]

Compute the solvent accessible surface area of the pocket residues.

The SASA is computed per residue on the first model of the full receptor, so each pocket residue is shielded by its receptor neighbours, and then summed over the pocket residues.

Parameters:
  • structure (Bio.PDB.Structure.Structure) – The receptor structure.

  • residues (List[Bio.PDB.Residue.Residue]) – The pocket residues (belonging to the first model of structure).

  • n_points (int, optional) – The number of points per atom used in the calculation, by default 100.

Returns:

The pocket SASA, or None if it cannot be computed.

Return type:

float | None

OCDocker.Pocket.count_hbond_atoms(residues, ligand_coordinates, cutoff=8.0)[source]

Count side-chain hydrogen-bond donor and acceptor atoms lining the pocket.

Only side-chain heavy atoms within cutoff of any reference-ligand heavy atom are counted. Atoms that can both donate and accept (e.g. SER OG) are counted in both groups.

Parameters:
  • residues (List[Bio.PDB.Residue.Residue]) – The pocket residues.

  • ligand_coordinates (np.ndarray) – The reference ligand heavy-atom coordinates, shape (n, 3).

  • cutoff (float, optional) – The distance cutoff in angstroms, by default 8.0.

Returns:

The number of donor and acceptor atoms.

Return type:

Tuple[int, int]

OCDocker.Pocket.count_pocket_AAs(residues)[source]

Count how many of each of the 20 standard AAs are in the pocket.

Parameters:

residues (List[Bio.PDB.Residue.Residue]) – The pocket residues.

Returns:

A dictionary with the count of each AA (non-standard residues are counted as ‘X’).

Return type:

Dict[str, int]

OCDocker.Pocket.get_ligand_heavy_atom_coordinates(reference_ligand)[source]

Get the heavy-atom coordinates of the reference ligand.

The ligand is loaded without sanitization, since only its coordinates are needed and charge-state issues must not discard a valid pocket.

Parameters:

reference_ligand (str | rdkit.Chem.rdchem.Mol) – The reference ligand path or an RDKit Mol with 3D coordinates.

Returns:

The heavy-atom coordinates, shape (n, 3), or None if they cannot be read.

Return type:

np.ndarray | None

OCDocker.Pocket.read_descriptors_from_json(path, returnData=False)[source]

Read the descriptors from a json file.

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

  • returnData (bool, optional) – If True, returns a dictionary with the descriptors. By default False.

Returns:

The descriptors dictionary (or a tuple ordered as Name, Cutoff, Residues followed by Pocket.allDescriptors) or None if any error occurs.

Return type:

Dict[str, str | float | int] | Tuple[str | float | int, …] | None

OCDocker.Pocket.select_pocket_residues(structure, ligand_coordinates, cutoff=8.0)[source]

Select the standard residues with any heavy atom within the cutoff of the ligand.

Only the first model is considered, water and hetero residues are ignored, and hydrogens are excluded from the distance search.

Parameters:
  • structure (Bio.PDB.Structure.Structure) – The receptor structure.

  • ligand_coordinates (np.ndarray) – The reference ligand heavy-atom coordinates, shape (n, 3).

  • cutoff (float, optional) – The distance cutoff in angstroms, by default 8.0.

Returns:

The pocket residues, in structure order.

Return type:

List[Bio.PDB.Residue.Residue]