Overlap Filter¶
Filter an IntervalTrack by geometric overlap with a label track. Supports keep mode (retain overlapping regions) and exclude mode (retain non-overlapping regions), with optional state matching on label names.
from seqchain.recipes.filter import filter_by_overlap
# Keep only guides in closed chromatin
closed_guides = filter_by_overlap(guide_track, chromatin_track, state="closed")
# Exclude guides near promoters
non_promoter = filter_by_overlap(guide_track, promoter_track, exclude=True)
filter
¶
Forwarding stub — implementation moved to _draft/.
filter_by_overlap
¶
filter_by_overlap(query_track: IntervalTrack, label_track: IntervalTrack, *, state: str | None = None, exclude: bool = False) -> IntervalTrack
Filter regions by spatial overlap with labeled regions.
Iterates every region in query_track, queries label_track for overlapping label regions, and keeps (or excludes) the query region based on whether a matching overlap exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query_track
|
IntervalTrack
|
The track whose regions are tested. |
required |
label_track
|
IntervalTrack
|
Track whose regions serve as the filter. |
required |
state
|
str | None
|
If given, only label regions whose |
None
|
exclude
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
IntervalTrack
|
A new |
IntervalTrack
|
containing only regions that pass the filter. |
Examples: