get_residue_positions
#
- biotite.structure.get_residue_positions(array, indices)[source]#
For each given atom index, obtain the position of the residue corresponding to this index in the input array.
For example, the position of the first residue in the atom array is
0
, the the position of the second residue is1
, etc.- 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 positions for. Negative indices are not allowed.
- Returns:
- start_indicesndarray, dtype=int, shape=(k,)
The indices that point to the position of the residues.
See also
Examples
>>> atom_index = [5, 42] >>> print(atom_array.res_name[atom_index]) ['ASN' 'TYR'] >>> _, residues = get_residues(atom_array) >>> print(residues) ['ASN' 'LEU' 'TYR' 'ILE' 'GLN' 'TRP' 'LEU' 'LYS' 'ASP' 'GLY' 'GLY' 'PRO' 'SER' 'SER' 'GLY' 'ARG' 'PRO' 'PRO' 'PRO' 'SER'] >>> residue_index = get_residue_positions(atom_array, atom_index) >>> print(residue_index) [0 2] >>> print(residues[residue_index]) ['ASN' 'TYR']