Replies: 1 comment
-
|
Yes, I think your interpretation is correct. CountsInRegion() is documented as counting reads per cell overlapping a set of regions, and the current Signac source uses findOverlaps(...), takes queryHits(overlaps), subsets the count matrix with those hits, and then sums them. Because those hits are not made unique, the same bin/feature can be counted multiple times if it overlaps multiple supplied regions. That means FractionCountsInRegion() can exceed 1 when the region set itself contains overlapping intervals. So in practice, if you want a true “fraction of reads in regions,” it is safer to first collapse overlapping regions, for example with reduce(regions), or otherwise deduplicate the overlapping feature indices before summing. For disjoint region sets, the current function should behave as expected. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I’m currently learning to use Signac for analysing single-cell chromatin data from histone marks, and while exploring quality metrics like fraction of reads in enhancer and promoter regions I noticed that FractionCountsInRegion() sometimes returns values greater than 1.
I initially thought this might reflect some normalization step, but when I looked into the source code I saw that the helper function CountsInRegion() uses queryHits(findOverlaps(...)) to subset the count matrix. I wonder if this might accidentally count the same bin multiple times when a single bin overlaps several regions (e.g., enhancers). Of course, it’s possible that I’m misunderstanding the intended behaviour — if this design is correct for a reason I’ve missed, I’d really appreciate clarification.
In the toy example below, all five enhancer intervals overlap the same bin. FractionCountsInRegion() seems to sum that bin five times (once per overlap), producing fractions > 1. When I collapse to unique bin indices (unique(queryHits)), the result becomes ≤ 1, which in my mind matches the idea of “fraction of reads in regions.”
Thank you very much for your time and for maintaining this great package
sessionInfo()
Beta Was this translation helpful? Give feedback.
All reactions