collapseAt | R Documentation |
Collapse a SummarizedExperiment-like object over a GRanges, sensibly. Handy for things like chromophobe model testing, GenometriCorr, etc.
collapseAt(x, y, how = c("median", "mean", "sum"), BPPARAM = SerialParam())
x |
something descended from SummarizedExperiment, with assays() |
y |
something descended from a GRanges, with a granges() method |
how |
how to summarize the assay values (default: median) |
BPPARAM |
BPPARAM object to run in parallel (default: SerialParam()) |
TODO: let the user provide their own summarizer function
an object with same colData but with new rowData and assays
set.seed(123)
rr <- as(c("chr8:11657801-11665899","chr8:11665900-11700200"), "GRanges")
cd <- DataFrame(sample=letters[1:4], treatment=c(0,1,0,1))
rownames(cd) <- cd$sample
beta <- matrix(runif(8), nrow=length(rr), ncol=nrow(cd),
dimnames=list(as.character(rr), rownames(cd)))
tpm <- matrix(exp(rnorm(8)), nrow=length(rr), ncol=nrow(cd),
dimnames=list(as.character(rr), rownames(cd)))
se <- SummarizedExperiment(list(beta=beta,tpm=tpm), rowRanges=rr, colData=cd)
gr <- as("chr8:11665843-11665969", "GRanges")
collapseAt(se, gr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.