binGCCorrect: Correct coverage for GC content

View source: R/preprocess-utils.R

binGCCorrectR Documentation

Correct coverage for GC content

Description

Normalizes the coverage for a set of bins such that there is no correlation between GC content and coverage.

Usage

binGCCorrect(bins)

Arguments

bins

a GRanges object. This must contain a metadata column of numerics named std_cnt that is generally generated by binNormalize().

Details

The relationship of counts to GC content is determined by fitting a loess curve. The lowess curve is subtracted from the counts for each bin to remove any GC bias.

Value

A numeric vector of normalized counts for each bin.

Examples

library(Rsamtools)
library(svbams)
library(svfilters.hg19)
library(trellis)
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 <- trellis::binnedCounts(bviews)
std_cnt <- binNormalize(bins)
bins$std_cnt <- std_cnt
bins$log_ratio <- binGCCorrect(bins)
bins

cancer-genomics/trellis documentation built on Feb. 2, 2023, 7:04 p.m.