[BioC] Turning a GRanges Metadata Column into Rle List
Dario Strbenac
D.Strbenac at garvan.org.au
Mon Jan 7 06:00:10 CET 2013
Anything neater than this available ?
g <- GRanges(c("chr1", "chr2"), IRanges(c(10, 50), c(15, 55)), scores = c(20, 10))
seqlengths(g) <- c(100, 100)
chrRanges <- split(g, seqnames(g))
lapply(chrRanges, function(x)
{
scoreVect <- rep(NA, seqlengths(x)[1])
invisible(mapply(function(st, end, score) scoreVect[st:end] <<- score, start(x), end(x), values(x)[,1]))
Rle(scoreVect)
})
Then, code to define views on these Rle and calculate view summaries.
--------------------------------------
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia
More information about the Bioconductor
mailing list