BPCells icon indicating copy to clipboard operation
BPCells copied to clipboard

`qc_scATAC()` can try to quantify negative ranges

Open bjmt opened this issue 1 month ago • 2 comments

Hi,

I've been getting this error when running qc_scATAC(): Peaks are not in sorted order by (chr, end, start). This was a rather confusing error message, and it took some digging before I found the cause is due to qc_scATAC() generating negative ranges if input ranges are, for example, below 2000:

https://github.com/bnprks/BPCells/blob/93f16ffe4c56dad9e7187183a1e6f22a41b8f73a/r/R/atac_utils.R#L208-L221

As a result, when these ranges are eventually passed to the PeakMatrix::PeakMatrix function, the negative ranges get turned into very large unsigned values and thus trigger the 'not in sorted order' error (as the following ranges will be smaller).

bjmt avatar Nov 10 '25 15:11 bjmt

Good catch. I'll try to get a fix either today or tomorrow. Thanks!

immanuelazn avatar Nov 10 '25 22:11 immanuelazn

Let me know if this has fixed the problem.

Immanuel

immanuelazn avatar Nov 11 '25 22:11 immanuelazn