get_residue_starts_for#

biotite.structure.get_residue_starts_for(array, indices)[source]#

For each given atom index, get the index that points to the start of the residue that atom belongs to.

Parameters:
arrayAtomArray or AtomArrayStack

The atom array (stack) to determine the residues from.

indicesndarray, dtype=int, shape=(k,)

These indices point to the atoms to get the corresponding residue starts for. Negative indices are not allowed.

Returns:
start_indicesndarray, dtype=int, shape=(k,)

The indices that point to the residue starts for the input indices.

Examples

>>> indices = [5, 42]
>>> residue_starts = get_residue_starts_for(atom_array, indices)
>>> print(residue_starts)
[ 0 35]
>>> print(atom_array[indices[0]])
    A       1  ASN CG     C       -10.915    3.130   -2.611
>>> print(atom_array[residue_starts[0]])
    A       1  ASN N      N        -8.901    4.127   -0.555
>>> print(atom_array[indices[1]])
    A       3  TYR CD2    C        -1.820    4.326    3.332
>>> print(atom_array[residue_starts[1]])
    A       3  TYR N      N        -4.354    3.455   -0.111