ailist.AIList.intersect_from_array#
- AIList.intersect_from_array(self, const long[::1] starts, const long[::1] ends, const long[::1] ids)#
Find interval indices overlapping given ranges
- Parameters:
- starts : numpy.ndarray{long}
Start positions of intervals
- ends : numpy.ndarray{long}
End positions of intervals
- ids : numpy.ndarray{long}
ID of intervals
- Returns:
- ref_indexnp.ndarray{int}
Overlapping interval indices from AIList
- query_indexnp.ndarray{int}
Overlapping interval indices from query AIList
.. warning:: – This requires
construct()
and will run it if not already run. This will re-sort intervals inplace.
See also
AIList.construct
Construct AIList, required to call AIList.intersect
AIList.add
Add interval to AIList
AIList.intersect
Find intervals overlapping given range
AIList.intersect_index
Find interval indices overlapping given range
Examples
>>> from ailist import AIList >>> ail1 = AIList() >>> ail1.add(1, 2) >>> ail1.add(3, 4) >>> ail1.add(2, 6) >>> ail1 AIList range: (1-6) (1-2, 0) (3-4, 1) (2-6, 2) >>> ail2 = AIList() >>> ail2.add(1, 2) >>> ail2.add(3, 6) >>> ail2 AIList range: (1-6) (1-2, 0) (3-6, 1) >>> q = ail1.intersect_from_array(ail2) >>> q (array([2, 1]), array([]))