scverse / genomic-features

Genomic Features in Python from BioConductor's AnnotationHub
https://genomic-features.readthedocs.io
BSD 3-Clause "New" or "Revised" License
18 stars 5 forks source link

Filter by genomic range #32

Closed emdann closed 1 year ago

emdann commented 1 year ago

Added RangesFilter to subset gene annotations in a specific range, filtering by any overlap or annotations within a range.

#  ------------------------ OVERLAP TYPE: any ------------------------ #
# Range:       |==============================|
# Annotation: |---|     |-------|           |-----| |---|
# Selected:    ***       *******             *****

#  ------------------------ OVERLAP TYPE: within --------------------- #
# Range:       |==============================|
# Annotation: |---|     |-------|           |-----| |---|
# Selected:              *******
review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

codecov-commenter commented 1 year ago

Codecov Report

Merging #32 (4bd3181) into main (8e336e9) will increase coverage by 1.03%. The diff coverage is 95.83%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #32 +/- ## ========================================== + Coverage 88.40% 89.44% +1.03% ========================================== Files 6 6 Lines 138 161 +23 ========================================== + Hits 122 144 +22 - Misses 16 17 +1 ``` | [Impacted Files](https://codecov.io/gh/scverse/genomic-features/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse) | Coverage Δ | | |---|---|---| | [src/genomic\_features/\_core/filters.py](https://codecov.io/gh/scverse/genomic-features/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL2dlbm9taWNfZmVhdHVyZXMvX2NvcmUvZmlsdGVycy5weQ==) | `87.87% <95.65%> (+2.35%)` | :arrow_up: | | [src/genomic\_features/filters.py](https://codecov.io/gh/scverse/genomic-features/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL2dlbm9taWNfZmVhdHVyZXMvZmlsdGVycy5weQ==) | `100.00% <100.00%> (ø)` | |
lauradmartens commented 1 year ago

I tried it and it looks good to me! One point: Will we have one ranges filter for each genes, transcripts etc.? Otherwise, we will have to think about how we set the columns correctly

ivirshup commented 1 year ago

@lauradmartens, good point. I think it makes sense to have separate filters, since that let's you specify "get all exons for any gene in this range".

Since we'll tweet a link to the docs later today, and I'd like to have this merged, I went ahead and made a couple changes:

Happy to revert any of these, but wanted genomic range functionality in the demo

emdann commented 1 year ago

I think it would make sense to rename the "main coordinates" in every table (as discussed here https://github.com/scverse/genomic-features/issues/33) for more general filter function and compatibility with bioframe