get_residue_masks
#
- biotite.structure.get_residue_masks(array, indices)[source]#
Get boolean masks indicating the residues to which the given atom indices belong.
- Parameters:
- arrayAtomArray, shape=(n,) or AtomArrayStack, shape=(m,n)
The atom array (stack) to determine the residues from.
- indicesndarray, dtype=int, shape=(k,)
These indices indicate the atoms to get the corresponding residues for. Negative indices are not allowed.
- Returns:
- residues_masksndarray, dtype=bool, shape=(k,n)
Multiple boolean masks, one for each given index in indices. Each array masks the atoms that belong to the same residue as the atom at the given index.
Examples
>>> indices = [5, 42] >>> residue_masks = get_residue_masks(atom_array, indices) >>> print(atom_array[indices[0]]) A 1 ASN CG C -10.915 3.130 -2.611 >>> print(atom_array[residue_masks[0]]) A 1 ASN N N -8.901 4.127 -0.555 A 1 ASN CA C -8.608 3.135 -1.618 A 1 ASN C C -7.117 2.964 -1.897 A 1 ASN O O -6.634 1.849 -1.758 A 1 ASN CB C -9.437 3.396 -2.889 A 1 ASN CG C -10.915 3.130 -2.611 A 1 ASN OD1 O -11.269 2.700 -1.524 A 1 ASN ND2 N -11.806 3.406 -3.543 A 1 ASN H1 H -8.330 3.957 0.261 A 1 ASN H2 H -8.740 5.068 -0.889 A 1 ASN H3 H -9.877 4.041 -0.293 A 1 ASN HA H -8.930 2.162 -1.239 A 1 ASN HB2 H -9.310 4.417 -3.193 A 1 ASN HB3 H -9.108 2.719 -3.679 A 1 ASN HD21 H -11.572 3.791 -4.444 A 1 ASN HD22 H -12.757 3.183 -3.294 >>> print(atom_array[indices[1]]) A 3 TYR CD2 C -1.820 4.326 3.332 >>> print(atom_array[residue_masks[1]]) A 3 TYR N N -4.354 3.455 -0.111 A 3 TYR CA C -3.690 2.738 0.981 A 3 TYR C C -4.102 1.256 1.074 A 3 TYR O O -3.291 0.409 1.442 A 3 TYR CB C -3.964 3.472 2.302 A 3 TYR CG C -2.824 3.339 3.290 A 3 TYR CD1 C -2.746 2.217 4.138 A 3 TYR CD2 C -1.820 4.326 3.332 A 3 TYR CE1 C -1.657 2.076 5.018 A 3 TYR CE2 C -0.725 4.185 4.205 A 3 TYR CZ C -0.639 3.053 5.043 A 3 TYR OH O 0.433 2.881 5.861 A 3 TYR H H -4.934 4.245 0.120 A 3 TYR HA H -2.615 2.768 0.796 A 3 TYR HB2 H -4.117 4.513 2.091 A 3 TYR HB3 H -4.886 3.096 2.750 A 3 TYR HD1 H -3.513 1.456 4.101 A 3 TYR HD2 H -1.877 5.200 2.695 A 3 TYR HE1 H -1.576 1.221 5.669 A 3 TYR HE2 H 0.033 4.952 4.233 A 3 TYR HH H 1.187 3.395 5.567