| binCount {RIPSeeker} | R Documentation |
Stratify chromosome into nonoverlapping bins of the same size and count the number of reads that fall within each bin.
binCount(alignGR, binSize, returnBinCountOnly = FALSE)
alignGR |
GRanges object containing the alignments for a single chromosome. |
binSize |
An integer for the bin size. |
returnBinCountOnly |
Binary indicator. If TRUE, only the integer read count is returned; if FALSE, GRanges of bins with value slot saved as the corresponding read counts is returned. |
The funciton is designed to operate to a single chromosome to facilitate parallel computing on multiple chromosomes independently. The function is used in evalBinSize to select the optimal bin size based on the read counts and in mainSeekSingleChrom to provide the read count as input for the HMM.
If returnBinCountOnly is TRUE, then the integer read count is returned; if returnBinCountOnly is FALSE, then the GRanges of bins with value slot saved for the corresponding read counts is returned.
Yue Li
P. Aboyoun, H. Pages and M. Lawrence. GenomicRanges: Representation and manipulation of genomic intervals. R package version 1.8.9.
# Retrieve system files
extdata.dir <- system.file("extdata", package="RIPSeeker")
bamFiles <- list.files(extdata.dir, ".bam$", recursive=TRUE, full.names=TRUE)
bamFiles <- grep("PRC2", bamFiles, value=TRUE)
alignGal <- getAlignGal(bamFiles[1], reverseComplement=TRUE, genomeBuild="mm9")
alignGR <- as(alignGal, "GRanges")
alignGRList <- GRangesList(as.list(split(alignGR, seqnames(alignGR))))
binSize <- 1000
binGR <- binCount(alignGRList$chrX, binSize)