ailist.IntervalArray.has_hit#

IntervalArray.has_hit(start, end)[source]#

Find interval indices overlapping given ranges

Parameters:
starts : int | numpy.ndarray {long}

Start positions of intervals

ends : int | numpy.ndarray {long}

End positions of intervals

Returns:

  • has_hitnp.ndarray {bool}

    Bool array indicated overlap detected

  • .. warning:: – This requires construct() and will run it if not already run. This will re-sort intervals inplace if ail.track_index = False.

See also

IntervalArray.construct

Construct IntervalArray, required to call IntervalArray.intersect

IntervalArray.add

Add interval to IntervalArray

IntervalArray.intersect

Find intervals overlapping given range

IntervalArray.intersect_index

Find interval indices overlapping given range

Examples

>>> from aiarray import IntervalArray
>>> ail1 = IntervalArray()
>>> ail1.add(1, 2)
>>> ail1.add(3, 4)
>>> ail1.add(2, 6)
>>> ail1
IntervalArray
    (1-2)
    (3-4)
    (2-6)
>>> ail2 = IntervalArray()
>>> ail2.add(1, 2)
>>> ail2.add(3, 6)
>>> ail2
IntervalArray
    (1-2)
    (3-6)
>>> q = ail1.intersect_from_array(ail2)
>>> q
(array([2, 1]), array([]))