filter_intersection#
- biotite.structure.filter_intersection(array, intersect, categories=None)[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.
- Parameters:
- arrayAtomArray or AtomArrayStack
The array to be filtered.
- intersectAtomArray
Atoms in array that also exists in intersect are filtered.
- categoriesiterable of str
If specified, the given annotation categories are checked for equality in both arrays. By default, all common annotation categories are checked.
- Returns:
- filterndarray, dtype=bool
This array is True for all indices in array, where the atom exists also in intersect.
Examples
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']