Last data update: 2014.03.03

R: Calculate percent methylation
calcMethR Documentation

Calculate percent methylation

Description

Function to calculate percent methylation from a collection of peaks corresponding to a single fragment.

Usage

calcMeth(SNR.list, fragments = rep(1, length(SNR.list)), non.cg.fragments = numeric(0), method = c("weighted", "proportion"), prune.non.cg.peaks = TRUE, na.rm = FALSE)

Arguments

SNR.list

List of signal-to-noise ratios, sorted from low to high MWs, corresponding to the unmethylated and methylated peaks for a given set of fragments

fragments

List of all fragments contributing to each of the input peaks, automatically defaulting to a single fragment

non.cg.fragments

List of fragments (without CGs) contributing to any of the input peaks, automatically defaulting to numeric(0)

method

Specifies which algorithm to use when calculating percent methylation (either "weighted" or "proportion")

prune.non.cg.peaks

Boolean value determining whether or not to remove non-CG-containing fragments prior to analysis or whether to include them in the calculating model (note that setting this option to FALSE could result in a considerable increase in analytical time); option automatically defaults to TRUE

na.rm

Boolean value determing whether or not to return an error on input of any unspecified data (NA), automatically defaulting to FALSE

Details

Note that the current release of this function performs as expected for the large majority of cases. However, certain complex combinations of peak overlaps are not handled at this time. This may affect data for a minority of points, particularly those containing multiple overlaps with alternative fragments. Please ensure more in-depth review of such loci.

Value

Returns a numerical values corresponding to percent methylation, with 0

Author(s)

Reid F. Thompson (rthompso@aecom.yu.edu), John M. Greally (jgreally@aecom.yu.edu)

References

Coolen, M.W., et al. (2007) Genomic profiling of CpG methylation and allelic specificity using quantitative high-throughput mass spectrometry: critical evaluation and improvements, Nucleic Acids Research, 35(18), e119.

See Also

See Also MassArrayPeak

Examples

data(MassArray.example.data)
frags <- MassArray.example.data$fragments.T[[6]]$"MW"
peaks <- findPeaks(frags, unlist(lapply(MassArray.example.data$samples[[1]]$peaks, slot, "MW.actual")))
SNRs <- unlist(lapply(MassArray.example.data$samples[[1]]$peaks[peaks], slot, "SNR"))
frag.list <- list(1:3, 1:3, 1:3, 1:3)
calcMeth(SNRs, fragments=frag.list, method="weighted")
calcMeth(SNRs, fragments=frag.list, method="proportion")

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(MassArray)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/MassArray/calcMeth.Rd_%03d_medium.png", width=480, height=480)
> ### Name: calcMeth
> ### Title: Calculate percent methylation
> ### Aliases: calcMeth
> ### Keywords: arith manip
> 
> ### ** Examples
> 
> data(MassArray.example.data)
> frags <- MassArray.example.data$fragments.T[[6]]$"MW"
> peaks <- findPeaks(frags, unlist(lapply(MassArray.example.data$samples[[1]]$peaks, slot, "MW.actual")))
> SNRs <- unlist(lapply(MassArray.example.data$samples[[1]]$peaks[peaks], slot, "SNR"))
> frag.list <- list(1:3, 1:3, 1:3, 1:3)
> calcMeth(SNRs, fragments=frag.list, method="weighted")
         1          2          3 
0.05819519 0.05819519 0.05819519 
> calcMeth(SNRs, fragments=frag.list, method="proportion")
       1        2        3 
0.106167 0.106167 0.106167 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>