if (require(RNAseqData.HNRNPC.bam.chr14)) {
fl <- RNAseqData.HNRNPC.bam.chr14_BAMFILES
rd <- GRanges("chr14",
IRanges(c(62262735, 63121531, 63980327), width=214700))
cd <- DataFrame(method=rep("RNASeq", length(fl)),
format=rep("bam", length(fl)))
## Construct an instance of the class:
gf <- GenomicFiles(files = fl, rowData = rd, colData = cd)
gf
## Subset on ranges or files for different experimental runs.
dim(gf)
gf_sub <- gf[2, 3:4]
dim(gf_sub)
## When summarize = TRUE and no REDUCE is provided the reduceBy*
## functions output a SummarizedExperiment object.
MAP <- function(range, file, ...) {
library(GenomicRanges) ## for coverage()
library(Rsamtools) ## for ScanBamParam()
param = ScanBamParam(which=range)
coverage(file, param=param)[range]
}
se <- reduceByRange(gf, MAP=MAP, summarize=TRUE)
se
## Data from the rowData, colData and exptData slots in the
## GenomicFiles are transferred to the SummarizedExperiment.
colData(se)
## Results are in the assays slot.
assays(se)
}
Run the code above in your browser using DataLab