phaverty/RLEVectors.jl

Coverage function to turn df into Rle?

Closed this issue · 4 comments

The original IRanges library has a function called coverage to turn interval data into an Rle. Will you consider implementing a coverage function?

Thanks for the library, btw.

Thanks. I searched the wrong repo then.

My intention is to translate it into Cython - I'll be sure to give you credit. I have an implementation myself, but it uses two heaps.

Julia looks nice! I need to learn it to be able to understand how you can write a coverage-function as simply as this, because I am guessing you are not instantiating a vector of chromosome length:

function coverage(gr::AbstractGenomicVector)
    out = RLEVector(0, last(chr_ends(gr)))
    for (s,e) in eachrange(gr)
        out[s:e] += 1
    end
    out
end