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 the docking centre alone: every standard receptor residue with at least one heavy atom within a radius of that centre belongs to the pocket, so no reference ligand is needed. One receptor may hold several pockets, each built from its own centre.
Usage:
import OCDocker.Pocket as ocpocket
- class OCDocker.Pocket.Pocket(structure, center, name, radius=12.0, ph=7.4, gravy_scale='KyteDoolitle', from_json_descriptors='', overwrite=False, clean=False, canonicalize_pdb='auto')[source]¶
Bases:
objectRepresents a receptor binding pocket defined by its docking centre.
The pocket is the set of standard receptor residues with at least one heavy atom within
radiusangstroms of the docking centre. 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.
center (Sequence[float] | str) – Docking centre as
(x, y, z)in angstroms, or the path to an OCDocker docking box file holding it. Not required whenfrom_json_descriptorsis given.name (str) – Name identifier for the pocket.
radius (float, optional) – Heavy-atom distance from the centre in angstroms defining the pocket, by default 12.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
- center¶
Docking centre defining the pocket, in angstroms.
- Type:
Tuple[float, float, float]
- 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:resnameidentifiers.- Type:
list[str]
- radius¶
Heavy-atom distance from the centre 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
radiusof the centre.- Type:
int
- countHBondAcceptors¶
Side-chain hydrogen-bond acceptor atoms within
radiusof the centre.- 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, center, name, radius=12.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.
center (Sequence[float] | str) – Docking centre as
(x, y, z)OR path to an OCDocker docking box file.name (str) – Name of the pocket.
radius (float, optional) – Heavy-atom distance from the centre in angstroms defining the pocket, by default 12.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 path, centre, radius 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, center, radius=12.0)[source]¶
Count side-chain hydrogen-bond donor and acceptor atoms lining the pocket.
Only side-chain heavy atoms within
radiusof the centre 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.
center (np.ndarray) – The pocket centre, shape
(3,).radius (float, optional) – The distance from the centre in angstroms, by default 12.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.read_box_center(box_path)[source]¶
Read the docking centre from an OCDocker docking box file.
- Parameters:
box_path (str) – Path to a box file written by OCDocker (
REMARK CENTER (X Y Z)line).- Returns:
The centre, shape
(3,), or None if it 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,Center,Radius,Residuesfollowed byPocket.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, center, radius=12.0)[source]¶
Select the standard residues with any heavy atom within the radius of the centre.
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.
center (np.ndarray) – The pocket centre, shape
(3,).radius (float, optional) – The distance from the centre in angstroms, by default 12.0.
- Returns:
The pocket residues, in structure order.
- Return type:
List[Bio.PDB.Residue.Residue]