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:
  • TypeErrorcavity must be a string or a pathlib.Path.

  • TypeErrorreceptor must be a string or a pathlib.Path.

  • TypeErrortarget must have .pdb or .xyz extension.

  • TypeErrorstep must be a positive real number.

  • ValueErrorstep must be a positive real number.

  • TypeErrorprobe_in must be a non-negative real number.

  • ValueErrorprobe_in must be a non-negative real number.

  • TypeErrorprobe_out must be a non-negative real number.

  • ValueErrorprobe_out must be a non-negative real number.

  • ValueErrorprobe_out must be greater than probe_in.

  • TypeErrorsurface must be a str.

  • TypeErrornthreads must be a positive integer.

  • ValueErrornthreads must be a positive integer.

  • TypeErrorverbose must be a boolean.

  • ValueErrorsurface 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 with read_vdw as shown earlier and pass it as read_cavity(cavity, receptor, vdw=vdw).

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)