overlapping

method of dascore.core.annotations.AnnotationSet source

overlapping(
    self ,
    **bounds ,
)-> ‘AnnotationSet’

Return the features whose bounds overlap the given ones.

Each keyword names a dimension, as (low, high) with either end None, or a single value; (v, v) is the same point query as v. A query range is half-open, as is a feature’s range, except where its maximum is a stated value (see bounds). A feature spanning a dimension overlaps anything along it. Nothing is trimmed: a feature is kept or dropped whole.

Examples

import pandas as pd
import dascore as dc
frame = pd.DataFrame({"time_min": [0.0, 5.0], "time_max": [2.0, 9.0]})
boxes = dc.AnnotationSet(frame, dims=("time", "distance"))
len(boxes.overlapping(time=(1.0, 3.0)))
1