-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep OverlapDetector generic but normalize the getters for BedRecord and Interval #36
Keep OverlapDetector generic but normalize the getters for BedRecord and Interval #36
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## cv_generic_overlap_detector #36 +/- ##
===============================================================
+ Coverage 92.61% 92.66% +0.05%
===============================================================
Files 8 8
Lines 609 641 +32
Branches 110 116 +6
===============================================================
+ Hits 564 594 +30
- Misses 27 30 +3
+ Partials 18 17 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it but I would only ask we add property names to make the interface between BedRecord
and Interval
consistent and not add the zero_based_start
and zero_based_open_end
at this time.
pybedlite/overlap_detector.py
Outdated
generic type contained within the :class:`~pybedlite.overlap_detector.OverlapDetector`. | ||
""" | ||
|
||
|
||
class OverlapDetector(Generic[_GenericGenomicSpan], Iterable[_GenericGenomicSpan]): | ||
class OverlapDetector(Generic[GenericGenomicsSpan], Iterable[GenericGenomicsSpan]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is GenericGenomicSpan
necessary? StrandedGenomicSpan
subclasses GenomicSpan
, why not just use GenomicSpan
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like it because it is explicit for the reader and shouldn't have any performance impact. Otherwise it might be overlooked that there is a tiny part of the OverlapDetector that does change behavior based on strand:
pybedlite/pybedlite/overlap_detector.py
Lines 305 to 307 in 49ff82c
@staticmethod | |
def _is_negative(interval: GenomicSpan) -> bool: | |
return getattr(interval, "is_negative", False) |
pybedlite/pybedlite/overlap_detector.py
Line 300 in 49ff82c
self._is_negative(intv), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a negative
property to BedRecord
so we have fewer duplicated getters across both classes instead of introducing is_negative
to both?
pybedlite/overlap_detector.py
Outdated
generic type contained within the :class:`~pybedlite.overlap_detector.OverlapDetector`. | ||
""" | ||
|
||
|
||
class OverlapDetector(Generic[_GenericGenomicSpan], Iterable[_GenericGenomicSpan]): | ||
class OverlapDetector(Generic[GenericGenomicsSpan], Iterable[GenericGenomicsSpan]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like it because it is explicit for the reader and shouldn't have any performance impact. Otherwise it might be overlooked that there is a tiny part of the OverlapDetector that does change behavior based on strand:
pybedlite/pybedlite/overlap_detector.py
Lines 305 to 307 in 49ff82c
@staticmethod | |
def _is_negative(interval: GenomicSpan) -> bool: | |
return getattr(interval, "is_negative", False) |
pybedlite/pybedlite/overlap_detector.py
Line 300 in 49ff82c
self._is_negative(intv), |
e209994
to
cf99c00
Compare
Alternate to #34