Split tests into fit and test stages to work more like edgeR (for example) and allow users to examine the design matrix prior to making the contrast matrix.
Arguments
bs a BSseq object possibly having passed through prior filtering and tiling functions.
design a data.frame giving the experimental design. Rows are samples and columns are phenotype data.
formula a character string to be coerced to a formula describing the model. The terms of formula should correspond to columns of design. NOTE: The intercept is included by default if omitted, i.e. ~ group is equivalent to ~ 1 + group. One can omit the intercept with a formula such as ~ 0 + group.
contrast a column vector matrix with as many rows as there are columns in model.matrix(formula, design).
methylation_group_column a character string indicating the column of the design to use to recover methylation information. Can be a character, factor, or numeric vector.
methylation_groups a named character vector with names case and control indicating which factors of methylation_group_column to use as case and control. If methylation_group_column is a numeric, omit this and top 25% and bottom 25% samples (based on the covariate) will be used as groups for methylation recovery.
Values
A GRanges object with the following columns always:
stat
pvalue
fdr
And optionally the following columns, depending on presence of methylation_group_column and methylation_groups are given:
It would be nice, for continuous covariate tests, to return the methylation rates for the samples that have the top 25% and bottom 25% values for that covariate.
Function call
diff_dss_fit(bs, design, formula)
diff_dss_test(bs, diff_fit, contrast, methylation_group_column = NA, methylation_groups = NA)
Description
Split tests into fit and test stages to work more like
edgeR
(for example) and allow users to examine the design matrix prior to making the contrast matrix.Arguments
bs
aBSseq
object possibly having passed through prior filtering and tiling functions.design
adata.frame
giving the experimental design. Rows are samples and columns are phenotype data.formula
acharacter
string to be coerced to aformula
describing the model. The terms offormula
should correspond to columns ofdesign
. NOTE: The intercept is included by default if omitted, i.e.~ group
is equivalent to~ 1 + group
. One can omit the intercept with a formula such as~ 0 + group
.contrast
a column vectormatrix
with as many rows as there are columns inmodel.matrix(formula, design)
.methylation_group_column
acharacter
string indicating the column of the design to use to recover methylation information. Can be a character, factor, or numeric vector.methylation_groups
a namedcharacter
vector with namescase
andcontrol
indicating which factors ofmethylation_group_column
to use as case and control. Ifmethylation_group_column
is anumeric
, omit this and top 25% and bottom 25% samples (based on the covariate) will be used as groups for methylation recovery.Values
A
GRanges
object with the following columns always:And optionally the following columns, depending on presence of
methylation_group_column
andmethylation_groups
are given:Tests
Test for correct return type.