concatenate#

biotite.structure.concatenate(atoms)[source]#

Concatenate multiple AtomArray or AtomArrayStack objects into a single AtomArray or AtomArrayStack, respectively.

Parameters:
atomsiterable object of AtomArray or AtomArrayStack

The atoms to be concatenated. AtomArray cannot be mixed with AtomArrayStack.

Returns:
concatenated_atomsAtomArray or AtomArrayStack

The concatenated atoms, i.e. its array_length() is the sum of the array_length() of the input atoms.

Notes

The following rules apply:

  • Only the annotation categories that exist in all elements are transferred.

  • The box of the first element that has a box is transferred, if any.

  • The bonds of all elements are concatenated, if any element has associated bonds. For elements without a BondList an empty BondList is assumed.

Examples

>>> atoms1 = array([
...     Atom([1,2,3], res_id=1, atom_name="N"),
...     Atom([4,5,6], res_id=1, atom_name="CA"),
...     Atom([7,8,9], res_id=1, atom_name="C")
... ])
>>> atoms2 = array([
...     Atom([1,2,3], res_id=2, atom_name="N"),
...     Atom([4,5,6], res_id=2, atom_name="CA"),
...     Atom([7,8,9], res_id=2, atom_name="C")
... ])
>>> print(concatenate([atoms1, atoms2]))
            1      N                1.000    2.000    3.000
            1      CA               4.000    5.000    6.000
            1      C                7.000    8.000    9.000
            2      N                1.000    2.000    3.000
            2      CA               4.000    5.000    6.000
            2      C                7.000    8.000    9.000