diff_binomial: Differential methylation analysis using binomial model

View source: R/diff_binomial.R

diff_binomialR Documentation

Differential methylation analysis using binomial model

Description

This function calculates differential methylation statistics using a binomial-based approach. See ‘Warning’ message below.

Usage

diff_binomial(bs, group_column, comparison_groups)

Arguments

bs

A BSseq-class object to calculate differential methylation statistics. See methylSigReadData for how to read in methylation data.

group_column

a character string indicating the column of pData(bs) to use for determining group membership.

comparison_groups

a named character vector indicating the case and control factors of group_column for the comparison.

Details

This function uses a binomial-based model to calculate differential methylation statistics. It is nearly identical to the methylKit::calculateDiffMeth function in the methylKit R package except that only the likelihood ratio test and p.adjust(..., method='BH') are used to calculate significance levels. It is significantly faster than methylKit::calculateDiffMeth function.

Value

A GRanges object containing the following mcols:

meth_case:

Methylation estimate for case.

meth_control:

Methylation estimate for control.

meth_diff:

The difference meth_case - meth_control.

direction:

The group for which the lcous is hyper-methylated. Note, this is not subject to significance thresholds.

pvalue:

The p-value from the t-test (t_approx = TRUE) or the Chi-Square test (t_approx = FALSE).

fdr:

The Benjamini-Hochberg adjusted p-values using p.adjust(method = 'BH').

log_lik_ratio:

The log likelihood ratio.

Warning

This function does not take into account the variability among samples in each group being compared.

Examples

data(BS.cancer.ex, package = 'bsseqData')

bs = filter_loci_by_group_coverage(
    bs = BS.cancer.ex,
    group_column = 'Type',
    c('cancer' = 2, 'normal' = 2))

small_test = bs[1:50]

diff_gr = diff_binomial(
    bs = small_test,
    group_column = 'Type',
    comparison_groups = c('case' = 'cancer', 'control' = 'normal'))


sartorlab/methylSig documentation built on March 26, 2023, 10:04 a.m.