Description Usage Arguments Details Value See Also Examples
unpack
returns results obtained with pack()ed ranges
to the geometry of the original, unpacked ranges.
1 2 3 4 |
flesh |
A |
skeleton |
The |
... |
Arguments passed to other methods. |
unpack
returns a List
obtained with
packed ranges to the geometry and order of the original,
unpacked ranges.
A unpacked form of flesh
.
pack
for packing ranges.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | fl <- system.file("extdata", "ex1.bam", package = "Rsamtools")
gr <- GRanges(c(rep("seq2", 3), "seq1"),
IRanges(c(75, 1, 100, 1), width = 2))
## Ranges are packed by order within chromosome and grouped
## around gaps greater than 'inter_range_len'. See ?pack for details.
pk <- pack(gr, inter_range_len = 25)
## FUN computes coverage for the range passed as 'rng'.
FUN <- function(rng, fl, param) {
requireNamespace("GenomicAlignments") ## for bamWhich() and coverage()
Rsamtools::bamWhich(param) <- rng
GenomicAlignments::coverage(Rsamtools::BamFile(fl), param=param)[rng]
}
## Compute coverage on the packed ranges.
dat <- bplapply(as.list(pk), FUN, fl = fl, param = ScanBamParam())
## The result list contains RleLists of coverage.
lapply(dat, class)
## unpack() transforms the results back to the order of
## the original ranges (i.e., unpacked 'gr').
unpack(dat, pk)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.