create_continuous_res_ids#

biotite.structure.create_continuous_res_ids(atoms, restart_each_chain=True)[source]#

Create an array of continuous residue IDs for a given structure.

This means that residue IDs are incremented by 1 for each residue.

Parameters:
atomsAtomArray or AtomArrayStack

The atoms for which the continuous residue IDs should be created.

restart_each_chainbool, optional

If true, the residue IDs are reset to 1 for each chain.

Returns:
res_idsndarray, dtype=int

The continuous residue IDs.

Examples

>>> # Remove a residue to make the residue IDs discontinuous
>>> atom_array = atom_array[atom_array.res_id != 5]
>>> res_ids, _ = get_residues(atom_array)
>>> print(res_ids)
[ 1  2  3  4  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20]
>>> atom_array.res_id = create_continuous_res_ids(atom_array)
>>> res_ids, _ = get_residues(atom_array)
>>> print(res_ids)
[ 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19]