Last data update: 2014.03.03

R: Estimate the methylation status by fitting a Gamma mixture...
gammaFitEMR Documentation

Estimate the methylation status by fitting a Gamma mixture model using EM algorithm

Description

Estimate the methylation status by fitting a two component Gamma mixture model using EM algorithm based on the all M-values of a particular sample

Usage

gammaFitEM(M, initialFit = NULL, fix.k = NULL, weighted = TRUE, maxIteration = 50, tol = 1e-04, plotMode = FALSE, truncate=FALSE, verbose = FALSE)

Arguments

M

a vector of M-values covering the whole genome

initialFit

the initial estimation of the gamma parameters returned by .initialGammaEstimation function

fix.k

the k parameter of the gamma function which is fixed during estimation

weighted

determine whether to down-weight the long tails of two component densities beyond their modes

maxIteration

maximum iterations allowed before converging

tol

the difference threshold used to determine convergence

plotMode

determine whether plot the histogram and density plot estimation

truncate

determine whether to truncate the tails beyond the modes during parameter estimation

verbose

determine whether plot intermediate messages during iterations

Details

The assumption of this function is that the M-value distribution is composed of the mixture of two shifted gamma distributions, which are defined as: dgamma(x-s[1], shape=k[1], scale=theta[1]) and dgamma(s[2]-x, shape=k[2], scale=theta[2]). Here s represents the shift.

NOTE: the methylation status modeling algorithm was developed based on 27K methylation array. It has not been tested for 450K array. Considering 450K array covers both promoter and gene body, the two component Gamma mixture model assumption may not be valid any more.

Value

The return is a list with "gammaFit" class attribute, which includes the following items:

logLikelihood

the log-likelihood of the fitting model

k

parameter k of gamma distribution

theta

parameter theta of gamma distribution

shift

parameter shift of gamma distribution

proportion

the proportion of two components (gamma distributions)

mode

the mode positions of the gamma distributions

probability

the estimated methylation status posterior probability of each CpG site

Author(s)

Pan Du

See Also

methylationCall and plotGammaFit

Examples


data(example.lumiMethy)
M <- exprs(example.lumiMethy)
fittedGamma <- gammaFitEM(M[,1], initialFit=NULL, maxIteration=50, tol=0.0001, plotMode=TRUE, verbose=FALSE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(lumi)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Setting options('download.file.method.GEOquery'='auto')
Setting options('GEOquery.inmemory.gpl'=FALSE)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/lumi/gammaFitEM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: gammaFitEM
> ### Title: Estimate the methylation status by fitting a Gamma mixture model
> ###   using EM algorithm
> ### Aliases: gammaFitEM
> ### Keywords: methods
> 
> ### ** Examples
> 
> 
> data(example.lumiMethy)
> M <- exprs(example.lumiMethy)
> fittedGamma <- gammaFitEM(M[,1], initialFit=NULL, maxIteration=50, tol=0.0001, plotMode=TRUE, verbose=FALSE)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>