View source: R/preprocess-utils.R
binNormalize | R Documentation |
Log-transforms the counts for each bin and centers them by by the mode (default) or median of the counts for the autosomes.
binNormalize(bins, centerby = c("mode", "median"))
bins |
a |
centerby |
mode or median |
The bins
argument to binNormalize()
must be a GRanges
object with
chromosome names in the format [chr1, chr2, ...] and not [1, 2, ...] or any other naming convention.
There must be a metadata column of integers named cnt
corresponding to the raw counts
for each bin.
The output vector from binNormalize()
is generally appended back to bins
as a metadata column named std_cnt
for GC normalization by binGCCorrect()
.
A numeric vector of normalized counts.
library(Rsamtools)
library(svbams)
library(svfilters.hg19)
data(bins1kb)
extdir <- system.file("extdata", package="svbams", mustWork=TRUE)
bamfile <- file.path(extdir, "cgov10t.bam")
bins <- keepSeqlevels(bins1kb, "chr3", pruning.mode = "coarse")
bins <- subsetByOverlaps(bins, GRanges("chr3", IRanges(59600000, 61000000)))
bviews <- BamViews(bamRanges=bins, bamPaths=bamfile)
bins$cnt <- binnedCounts(bviews)
head(binNormalize(bins))
std_cnt <- binNormalize(bins)
bins$std_cnt <- std_cnt
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.