smoothSds: Smooth the standard deviations using a thresholded running...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/BSmooth.fstat.R

Description

Smooth the standard deviations using a thresholded running mean based on smoothed whole-genome bisulfite sequencing data.

Usage

1
2
    smoothSds(BSseqStat, k = 101, qSd = 0.75, mc.cores = 1, maxGap = 10^8,
              verbose = TRUE)

Arguments

BSseqStat

An object of class BSseqStat, typically an object returned by BSmooth.fstat(...) and not constructed by the user.

k

A positive scalar, see details.

qSd

A scalar between 0 and 1, see details.

mc.cores

The number of cores used. Note that setting mc.cores to a value greater than 1 is not supported on MS Windows, see the help page for mclapply.

maxGap

A scalar greater than 0, see details.

verbose

Should the function be verbose?

Details

The standard deviation estimates are smoothed using a running mean with a width of k and thresholded using qSd which sets the minimum standard deviation to be the qSd-quantile.

Value

An object of class BSseqStat. More speciically, the input BSseqStat object with the computed statistics added to the stats slot (accessible with getStats).

Author(s)

Kasper Daniel Hansen khansen@jhsph.edu

See Also

BSmooth.fstat for the function to create the appropriate BSseqStat input object. BSseqStat also describes the return class. This function is likely to be followed by the use of computeStat.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  
    if(require(bsseqData)) {
        # library(limma) required for makeContrasts()
        library(limma)
        data(keepLoci.ex)
        data(BS.cancer.ex.fit)
        BS.cancer.ex.fit <- updateObject(BS.cancer.ex.fit)
        ## Remember to subset the BSseq object, see vignette for explanation
        ## TODO: Kind of a forced example
        design <- model.matrix(~0 + BS.cancer.ex.fit$Type)
        colnames(design) <- gsub("BS\\.cancer\\.ex\\.fit\\$Type", "",
                                 colnames(design))
        contrasts <- makeContrasts(
            cancer_vs_normal = cancer - normal,
            levels = design
        )
        BS.stat <- BSmooth.fstat(BS.cancer.ex.fit[keepLoci.ex,],
                                 design,
                                 contrasts)
        BS.stat <- smoothSds(BS.stat)
        ## Comparing the raw standard deviations to the smoothed standard
        ## deviations
        summary(getStats(BS.stat, what = "rawSds"))
        summary(getStats(BS.stat, what = "smoothSds"))
    }
  

bsseq documentation built on Nov. 8, 2020, 7:53 p.m.