diff_dss_fit: Performs model fit for general experimental design

View source: R/diff_dss_fit.R

diff_dss_fitR Documentation

Performs model fit for general experimental design

Description

This function is a wrapper for DSS::DMLfit.multiFactor.

Usage

diff_dss_fit(bs, design, formula)

Arguments

bs

a BSseq object to calculate differential methylation statistics.

design

a data.frame or DataFrame for experimental design. Should contain as many rows as there are columns (samples) in bs, and the order of the rows should match the columns of bs. If omitted, will default to pData(bs).

formula

a formula for the linear model. It should refer to column names from design. NOTE: The intercept is included by default if omitted. One can omit the intercept with a formula such as '~ 0 + group'. For clarity, it helps to include the intercept explicitly as in '~ 1 + group'.

Value

A list object with:

gr:

a GRanges object with loci fit.

design:

the data.frame input as the experimental design.

formula:

the formula representing the model. Can be character or formula.

X:

the design matrix used in regression based on the design and formula. This should be consulted to determine the appropriate contrast to use in dss_fit_test().

fit:

a list with model fitting results. It has components beta, the estimated coefficients, and var.beta the estimated variance/covariance matrix for beta.

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_fit = diff_dss_fit(
    bs = small_test,
    design = bsseq::pData(bs),
    formula = '~ Type')


sartorlab/methylSig documentation built on Aug. 22, 2024, 5:58 p.m.