get_atom_name_indices#
- biotite.structure.get_atom_name_indices(atoms, atom_names)[source]#
For each residue, get the index of the atom with the given atom name.
- Parameters:
- atomsAtomArray or AtomArrayStack
Search for the indices of the given atom names in this structure.
- atom_nameslist of str, length=p
The names of the atoms to get the indices of.
- Returns:
- indicesndarray, dtype=int, shape=(k, p)
For every residue and atom name, the return value contains the atom index in the
AtomArraywhere the sought atom name is located. Where the atom name is not present in a residue, the array is filled with -1.
Examples
>>> indices = get_atom_name_indices(atom_array, ["CA", "CB"]) >>> print(indices) [[ 1 4] [ 17 20] [ 36 39] [ 57 60] [ 76 79] [ 93 96] [117 120] [136 139] [158 161] [170 -1] [177 -1] [184 187] [198 201] [209 212] [220 -1] [227 230] [251 254] [265 268] [279 282] [293 296]] >>> for row in indices: ... for index in row: ... if index != -1: ... print(atom_array[index]) ... print() A 1 ASN CA C -8.608 3.135 -1.618 A 1 ASN CB C -9.437 3.396 -2.889 A 2 LEU CA C -4.923 4.002 -2.452 A 2 LEU CB C -4.411 5.450 -2.619 A 3 TYR CA C -3.690 2.738 0.981 A 3 TYR CB C -3.964 3.472 2.302 A 4 ILE CA C -5.857 -0.449 0.613 A 4 ILE CB C -7.386 -0.466 0.343 A 5 GLN CA C -4.122 -1.167 -2.743 A 5 GLN CB C -4.292 -0.313 -4.013 A 6 TRP CA C -0.716 -0.631 -0.993 A 6 TRP CB C -0.221 0.703 -0.417 A 7 LEU CA C -1.641 -2.932 1.963 A 7 LEU CB C -2.710 -2.645 3.033 A 8 LYS CA C -3.024 -5.791 -0.269 A 8 LYS CB C -4.224 -5.697 -1.232 A 9 ASP CA C 0.466 -6.016 -1.905 A 9 ASP CB C 1.033 -4.839 -2.724 A 10 GLY CA C 2.060 -6.618 1.593 A 11 GLY CA C 2.626 -2.967 2.723 A 12 PRO CA C 6.333 -2.533 3.806 A 12 PRO CB C 6.740 -2.387 5.279 A 13 SER CA C 7.049 -6.179 2.704 A 13 SER CB C 6.458 -7.371 3.472 A 14 SER CA C 6.389 -5.315 -1.015 A 14 SER CB C 4.914 -4.993 -1.265 A 15 GLY CA C 9.451 -3.116 -1.870 A 16 ARG CA C 7.289 0.084 -2.054 A 16 ARG CB C 6.110 -0.243 -2.994 A 17 PRO CA C 6.782 3.088 0.345 A 17 PRO CB C 7.554 4.394 0.119 A 18 PRO CA C 3.287 4.031 1.686 A 18 PRO CB C 3.035 4.190 3.187 A 19 PRO CA C 1.185 6.543 -0.353 A 19 PRO CB C 0.048 6.014 -1.229 A 20 SER CA C 0.852 10.027 1.285 A 20 SER CB C 1.972 11.071 1.284