pyKVFinder.export_openings

pyKVFinder.export_openings(fn: str | Path, openings: ndarray, vertices: ndarray | List[List[float]], step: float | int = 0.6, selection: List[int] | List[str] | None = None, nthreads: int | None = None, append: bool = False, model: int = 0) None[source]

Export opening points (H) to a PDB-formatted file.

Parameters:
  • fn (Union[str, pathlib.Path]) – A path to PDB file for writing openings.

  • openings (numpy.ndarray) –

    Openings points in the 3D grid (openings[nx][ny][nz]). Openings array has integer labels in each position, that are:

    • -1: bulk points;

    • 0: cavity or biomolecule points;

    • 1: empty space points;

    • >=2: Opening points.

    The empty space points are regions that do not meet the chosen openings cutoff to be considered an opening.

  • vertices (Union[numpy.ndarray, List[List[float]]]) – A numpy.ndarray or a list with xyz vertices coordinates (origin, X-axis, Y-axis, Z-axis).

  • step (Union[float, int], optional) – Grid spacing (A), by default 0.6.

  • selection (Union[List[int], List[str]], optional) – A list of integer labels or a list of opening names to be selected, by default None.

  • nthreads (int, optional) – Number of threads, by default None. If None, the number of threads is os.cpu_count() - 1.

  • append (bool, optional) – Whether to append openings to the PDB file, by default False.

  • model (int, optional) – Model number, by default 0.

Raises:
  • TypeErroropenings must be a numpy.ndarray.

  • ValueErroropenings has the incorrect shape. It must be (nx, ny, nz).

  • TypeErrorvertices must be a list or a numpy.ndarray.

  • ValueErrorvertices has incorrect shape. It must be (4, 3).

  • TypeErrorstep must be a positive real number.

  • ValueErrorstep must be a positive real number.

  • TypeErrorselection must be a list of strings (opening names) or integers (opening labels).

  • ValueError – Invalid selection: {selection}.

  • TypeErrornthreads must be a positive integer.

  • ValueErrornthreads must be a positive integer.

  • TypeErrorappend must be a boolean.

  • TypeErrormodel must be a integer.

  • TypeErrorfn must be a string or pathlib.Path.

Note

The opening nomenclature is based on the integer label. The opening marked with 2, the first integer corresponding to a opening, is OAA, the opening marked with 3 is OAB, the opening marked with 4 is OAC and so on.

See also

export, detect, depths, openings

Example

With the opening points identified with openings, we can export them to a PDB-formatted file:

>>> from pyKVFinder import export_openings
>>> export_openings('openings.pdb', openings, vertices)