biotite.structure.filter_intersection(array, intersect)[source]

Filter all atoms of one array that exist also in another array.

An atom is defined as existent in the second array, if there is an atom in the second array that has the same annotation values in all categories that exists in both arrays.

arrayAtomArray or AtomArrayStack

The array to be filtered.


Atoms in array that also exists in intersect are filtered.

filterndarray, dtype=bool

This array is True for all indices in array, where the atom exists also in intersect.


Creating an atom array from atoms:

>>> array1 = AtomArray(length=5)
>>> array1.chain_id = np.array(["A","B","C","D","E"])
>>> array2 = AtomArray(length=3)
>>> array2.chain_id = np.array(["D","B","C"])
>>> array1 = array1[filter_intersection(array1, array2)]
>>> print(array1.chain_id)
['B' 'C' 'D']