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:
TypeError – openings must be a numpy.ndarray.
ValueError – openings has the incorrect shape. It must be (nx, ny, nz).
TypeError – vertices must be a list or a numpy.ndarray.
ValueError – vertices has incorrect shape. It must be (4, 3).
TypeError – step must be a positive real number.
ValueError – step must be a positive real number.
TypeError – selection must be a list of strings (opening names) or integers (opening labels).
ValueError – Invalid selection: {selection}.
TypeError – nthreads must be a positive integer.
ValueError – nthreads must be a positive integer.
TypeError – append must be a boolean.
TypeError – model must be a integer.
TypeError – fn 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.
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)