determineOffset: Function to determine the normalising offset f that accounts...

View source: R/determineOffset.R

determineOffsetR Documentation

Function to determine the normalising offset f that accounts for the relative sequencing depth.

Description

The composition of a library influences the resulting read densities. To adjust the modelled mean (in the Poisson model) for these composition effects, we estimate a normalising factor f that accounts simultaneously for overall sequencing depth and composition. The derivation of this offset is motivated by the M (log ratio) versus A (average-log-count) plot.

Usage

determineOffset(x, quantile = 0.998, controlPlot = list(show = FALSE, 
    nsamp = 50000, mfrow=c(1,1), xlim=NULL, ylim=NULL, main=NULL, ask=FALSE))

Arguments

x

BayMethList object.

quantile

quantile q to restrict values of A = log2(sampleInterest*control)/2

controlPlot

list defining whether a MA plot should be shown.

-

show logical. If 'TRUE' the corresponding MA plot is shown. (default FALSE)

-

nsamp number of genomic regions included in the plot. (These are sampled without replacement).

-

mfrow vector of the form "c(nr, nc)" to determine how several plots should be ordered.

-

xlim, ylim numeric vectors of length 2, giving the x and y coordinates ranges.

-

main If NULL the names of the sample of interest are used as title in the MA plot. Alternatively, a vector with length equal to the number of samples of interest can be provided.

-

ask logical. If 'TRUE' (and the R session is interactive) the user is asked for input, before a new figure is drawn. (default FALSE).

Value

A BayMethList object given as input, where the slot fOffset is filled accordingly.

Author(s)

Andrea Riebler

See Also

maPlot, plotSmear

Examples

   if(require(BSgenome.Hsapiens.UCSC.hg18)){
        windows <- genomeBlocks(Hsapiens, chrs="chr21", width=100, spacing=100)
        cpgdens <- cpgDensityCalc(windows, organism=Hsapiens, 
            w.function="linear", window=700)  
        co <- matrix(rnbinom(length(windows), mu=10, size=2), ncol=1)
        sI <- matrix(rnbinom(2*length(windows), mu=5, size=2), ncol=2)
        bm <- BayMethList(windows=windows, control=co, sampleInterest=sI,
            cpgDens=cpgdens)

        bm <- determineOffset(bm, controlPlot=list(show=TRUE, mfrow=c(1,2)))
   }

markrobinsonuzh/Repitools documentation built on March 20, 2024, 6:04 a.m.