pyKVFinder.hydropathy
- pyKVFinder.hydropathy(surface: ndarray, atomic: ndarray | List[List[str | float | int]], vertices: ndarray | List[List[float]], step: float | int = 0.6, probe_in: float | int = 1.4, hydrophobicity_scale: str | Path = 'EisenbergWeiss', ignore_backbone: bool = False, selection: List[int] | List[str] | None = None, nthreads: int | None = None, verbose: bool = False) Tuple[ndarray, Dict[str, float]] [source]
Hydropathy characterization of the detected cavities.
Map a target hydrophobicity scale per surface point and calculate average hydropathy of detected cavities.
- Parameters:
surface (numpy.ndarray) –
Surface points in the 3D grid (surface[nx][ny][nz]). Surface array has integer labels in each position, that are:
-1: bulk points;
0: biomolecule or empty space points;
>=2: surface points.
The empty space points are regions that do not meet the chosen volume cutoff to be considered a cavity.
atomic (Union[numpy.ndarray, List[List[Union[str, float, int]]]]) – A numpy array with atomic data (residue number, chain, residue name, atom name, xyz coordinates and radius) for each atom.
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.
probe_in (Union[float, int], optional) – Probe In size (A), by default 1.4.
hydrophobicity_scale (str, optional) –
Name of a built-in hydrophobicity scale or a path to a TOML-formatted file with a custom hydrophobicity scale, by default EisenbergWeiss. The hydrophobicity scale file defines the name of the scale and the hydrophobicity value for each residue and when not defined, it assigns zero to the missing residues (see Hydrophobicity scale file template). The package contains seven built-in hydrophobicity scales:
ignore_backbone (bool, optional) – Whether to ignore backbone atoms (C, CA, N, O) when defining interface residues, by default False.
selection (Union[List[int], List[str]], optional) – A list of integer labels or a list of cavity 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.
verbose (bool, optional) – Print extra information to standard output, by default False.
- Returns:
scales (numpy.ndarray) – A numpy.ndarray with hydrophobicity scale value mapped at surface points (scales[nx][ny][nz]).
avg_hydropathy (Dict[str, float]) – A dictionary with average hydropathy for each detected cavity and the range of the hydrophobicity scale (min, max).
- Raises:
TypeError – surface must be a numpy.ndarray.
ValueError – surface has the incorrect shape. It must be (nx, ny, nz).
TypeError – atomic must be a list or a numpy.ndarray.
ValueError – atomic has incorrect shape. It must be (n, 8).
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 – probe_in must be a non-negative real number.
ValueError – probe_in must be a non-negative real number.
TypeError – hydrophobicity_scale must be a string or a pathlib.Path.
TypeError – ignore_backbone must be a boolean.
TypeError – selection must be a list of strings (cavity names) or integers (cavity labels).
ValueError – Invalid selection: {selection}.
TypeError – nthreads must be a positive integer.
ValueError – nthreads must be a positive integer.
TypeError – verbose must be a boolean.
Note
The cavity nomenclature is based on the integer label. The cavity marked with 2, the first integer corresponding to a cavity, is KAA, the cavity marked with 3 is KAB, the cavity marked with 4 is KAC and so on.
See also
Example
With the surface points identified with
pyKVFinder.spatial
and atomic coordinates and information read withpyKVFinder.read_pdb
orpyKVFinder.read_xyz
, we can perform a hydropathy characterization, that maps a target hydrophobicity scale on surface points and calculate the average hydropathy>>> from pyKVFinder import hydropathy >>> scales, avg_hydropathy = hydropathy(surface, atomic, vertices) >>> scales array([[[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], ..., [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]], ..., [[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], ..., [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]]]) >>> avg_hydropathy {'KAA': -0.73, 'KAB': -0.05, 'KAC': -0.07, 'KAD': -0.62, 'KAE': -0.81, 'KAF': -0.14, 'KAG': -0.33, 'KAH': -0.16, 'KAI': -0.4, 'KAJ': 0.62, 'KAK': -0.99, 'KAL': 0.36, 'KAM': -0.33, 'KAN': 0.18, 'KAO': 0.88, 'KAP': -0.96, 'KAQ': 0.48, 'KAR': 0.24, 'EisenbergWeiss': [-1.42, 2.6]}
However, users may opt to ignore backbones contacts (C, CA, N, O) with the cavity when mapping hydrophobicity scales on surface points. Then, users must set
ignore_backbone
flag toTrue
.>>> from pyKVFinder import hydropathy >>> scales, avg_hydropathy = hydropathy(surface, atomic, vertices, ignore_backbone=True) >>> scales array([[[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], ..., [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]], ..., [[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], ..., [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]]]) >>> avg_hydropathy {'KAA': -0.7, 'KAB': 0.12, 'KAC': -0.08, 'KAD': -0.56, 'KAE': -0.28, 'KAF': -0.25, 'KAG': -0.28, 'KAH': -0.09, 'KAI': -0.4, 'KAJ': 0.96, 'KAK': -0.87, 'KAL': 0.23, 'KAM': 0.06, 'KAN': -0.1, 'KAO': 0.99, 'KAP': -1.04, 'KAQ': 0.48, 'KAR': -0.84, 'EisenbergWeiss': [-1.42, 2.6]}
References