pyKVFinder.read_cavity
- pyKVFinder.read_cavity(cavity: str | Path, receptor: str | Path, step: float | int = 0.6, probe_in: float | int = 1.4, probe_out: float | int = 4.0, surface: str = 'SES', vdw: Dict[str, Dict[str, float]] | None = None, nthreads: int | None = None, verbose: bool = False) ndarray [source]
Read cavities and receptor inside a 3D grid.
- Parameters:
cavity (Union[str, pathlib.Path]) – A path to a PDB file of cavities.
receptor (Union[str, pathlib.Path]) – A path to a PDB or XYZ file of the receptor.
step (Union[float, int], optional) – Grid spacing (A), by default 0.6.
probe_in (Union[float, int], optional) – Probe In size (A), by default 1.4.
probe_out (Union[float, int], optional) – Probe Out size (A), by default 4.0.
surface (str, optional) – Surface representation. Keywords options are SES (Solvent Excluded Surface) or SAS (Solvent Accessible Surface), by default “SES”.
vdw (Dict[str, Dict[str, float]], optional) – A dictionary containing radii values, by default None. If None, use output of
read_vdw()
.nthreads (Optional[int], optional) – Number of threads, by default None. If None, the number of threads is os.cpu_count() - 1.
verbose (bool, optional) – Print extra information to standard output, by default False.
- Returns:
grid – Cavity and receptor points in the 3D grid (grid[nx][ny][nz]). Grid array has integer labels in each position, that are:
-1: bulk points or empty space points;
0: biomolecule points;
>=2: cavity points.
- Return type:
numpy.ndarray
- Raises:
TypeError – cavity must be a string or a pathlib.Path.
TypeError – receptor must be a string or a pathlib.Path.
TypeError – target must have .pdb or .xyz extension.
TypeError – step must be a positive real number.
ValueError – step must be a positive real number.
TypeError – probe_in must be a non-negative real number.
ValueError – probe_in must be a non-negative real number.
TypeError – probe_out must be a non-negative real number.
ValueError – probe_out must be a non-negative real number.
ValueError – probe_out must be greater than probe_in.
TypeError – surface must be a str.
TypeError – nthreads must be a positive integer.
ValueError – nthreads must be a positive integer.
TypeError – verbose must be a boolean.
ValueError – surface must be SAS or SES, not {surface}.
Note
The function takes the built-in dictionary when the
vdw
argument is not specified. If you wish to use a custom van der Waals radii file, you must read it withread_vdw
as shown earlier and pass it asread_cavity(cavity, receptor, vdw=vdw)
.See also
read_pdb
,read_xyz
,get_vertices
,get_vertices_from_file
,spatial
,depth
,constitutional
,hydropathy
,export
Example
With a previously calculated cavity, that can be manually curated in a molecular visualization software, such as PyMOL, we can read it with its respective receptor back to pyKVFinder:
>>> import os >>> import pyKVFinder >>> from pyKVFinder import read_cavity >>> cavity = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.KVFinder.output.pdb') >>> receptor = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.pdb') >>> grid = read_cavity(cavity, receptor) >>> grid array([[[-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1], ..., [-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1]], ..., [[-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1], ..., [-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1], [-1, -1, -1, ..., -1, -1, -1]]], dtype=int32)