Skip to content

Commit

Permalink
refactor: use new constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
msto committed Mar 8, 2024
1 parent 9808c99 commit 3e50e79
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pybedlite/overlap_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,15 @@ def get_enclosed(self, interval: Interval) -> List[Interval]:

@classmethod
def from_bed(cls, path: Path) -> "OverlapDetector":
"""Builds an :class:`~samwell.overlap_detector.OverlapDetector` from a BED file.
"""Builds an :class:`~pybedlite.overlap_detector.OverlapDetector` from a BED file.
Args:
path: the path to the BED file
Returns:
An overlap detector for the regions in the BED file.
"""
detector = OverlapDetector()

for region in BedSource(path):
locatable = Interval(
refname=region.chrom,
start=region.start,
end=region.end,
negative=region.strand == BedStrand.Negative,
name=region.name,
)
detector.add(locatable)
detector.add(Interval.from_bedrecord(region))

Check warning on line 293 in pybedlite/overlap_detector.py

View check run for this annotation

Codecov / codecov/patch

pybedlite/overlap_detector.py#L293

Added line #L293 was not covered by tests

return detector

0 comments on commit 3e50e79

Please sign in to comment.