Closed mdeber closed 4 years ago
Hi,
Unfortunately this is an artefact of floating point arithmetic and the algorithm used to compute the weighted coverage. See this old thread on our support site for a more detailed explanation and how to work around it.
Best, H.
Ah, I did not find this, my apologies.
So I had already implemented a workaround like the one you described, but I have concerns about the potential for critical errors in this particular case (my own was really bad and easy to miss). I had assumed that the categorical lack of input coverage would necessitate zero weighted coverage, and unfortunately this assumption held in my unit tests.
With that in mind, I think a precision argument could be a really valuable feature addition, not least of which for the performance improvements you alluded to. Otherwise, I think it's worth considering if a note should be added to the documentation to alert users of precision artifacts within no-coverage regions.
Anyway, thanks for you help. All the best, Mike
Thanks Mike. These are good suggestions.
Hard to find anything on our support site so no worries. The search feature is basically broken. This is a known issue and it's been a problem for years. The good news is that the software running the support site will receive a major update soon (this summer) and I believe this will also include an improved search feature. Fingers crossed.
I added some clarifications about this in IRanges 2.23.7 (commit https://github.com/Bioconductor/IRanges/commit/c4653d6151215759aace4be26fa845a1bb41d129).
Cheers, H.
@mdeber After giving this more thoughts I decided to add a naive coverage()
implementation (via method="naive"
) that is immune to floating point artefacts in the no-coverage regions. This is in IRanges 2.23.8 and GenomicRanges 1.41.4. The trade-off is between accuracy and speed. See ?coverage
in IRanges for more information.
I've noticed that when using
coverage()
over IRanges/GRanges objects using theweight
argument, very small but non-zero values can be returned for empty positions.Thanks
[Edit: not unique to GRanges objects]