biotite.structure.stack

biotite.structure.stack(arrays)[source]

Create an AtomArrayStack from a list of AtomArray.

Parameters
arraysiterable object of AtomArray

The atom arrays to be combined in a stack. All atom arrays must have an equal number of atoms and equal annotation arrays.

Returns
stackAtomArrayStack

The stacked atom arrays.

Examples

Creating an atom array stack from two arrays:

>>> atom1 = Atom([1,2,3], chain_id="A")
>>> atom2 = Atom([2,3,4], chain_id="A")
>>> atom3 = Atom([3,4,5], chain_id="B")
>>> atom_array1 = array([atom1, atom2, atom3])
>>> print(atom_array1.coord)
[[1. 2. 3.]
 [2. 3. 4.]
 [3. 4. 5.]]
>>> atom_array2 = atom_array1.copy()
>>> atom_array2.coord += 3
>>> print(atom_array2.coord)
[[4. 5. 6.]
 [5. 6. 7.]
 [6. 7. 8.]]
>>> array_stack = stack([atom_array1, atom_array2])
>>> print(array_stack.coord)
[[[1. 2. 3.]
  [2. 3. 4.]
  [3. 4. 5.]]

 [[4. 5. 6.]
  [5. 6. 7.]
  [6. 7. 8.]]]