Function calculate_test computes log folds and p-values for choosen test for data from methylation or expression. The function uses: t-test, negative binomial test, likelihood-ratio test(LRT), quasi-likelihood F-test(QLF). By default function calls the t-test.

calculate_test(data, condition, test = "ttest", ...)

Arguments

data

An object of the class appropriate for the given test. More in details section.

condition

Factor of levels coresponding to order of samples in data.

test

Variable defining test. Values: ttest, nbinom, nbinom2, lrt, qlf, methyanalysis. More in details section.

...

Other parameters e.g. `adjust.method` for argument `ttest`.

Value

A data frame with the following columns:

id

The id of the observable, taken from the row names of the counts slots.

log2.fold

The log2 of the fold change.

pval

The p-values for rejecting the null hypothesis about the means equality.

mean

Column correspond to means for each gene defined by condition and mean for all probes.

Details

Each test may require different data. In this section we will describe details for each availible test:

ttest

Student's t-test
Test for expression and methylation.
This test is based on function lmFit from limma package.
For this test you should aggregate CpG probes to genes using function: aggregate_probes. Data for this test should have following structure: columns correspond to genes, rows to samples.

nbinom

Negative binomial test
Test for expression.
This test is based on function nbinomTest from DESeq package.
Data for this test should have following structure: columns correspond to genes, rows to samples.
Calculations may take some time. It is suggested to use nbinom2 parameter.

nbinom2

Negative binomial test
Test for expression.
This test is based on function DESeq from DESeq2 package.
Data for this test should have following structure: columns correspond to genes, rows to samples.

lrt

Likelihood-ratio test (LRT)
Test for expression.
This test is based on function glmFit and glmLRT from edgeR package.
Data for this test should have following structure: columns correspond to genes, rows to samples.

qlf

Quasi-likelihood F-test (QLF)
Test for expression.
This test is based on functions glmQLFit and glmQLFTest from edgeR package.
Data for this test should have following structure: columns correspond to genes, rows to samples.

methyanalysis

Slide window smoothing
Test for methylation.
This test is based on function detectDMR.slideWin from methyAnalysis package. It requires a special class of argument data - MethyGenoSet.

See also

Examples

# NOT RUN {
library(MLExpRessoData)
BRCA_methylation_gene <- aggregate_probes(BRCA_methylation_all)

condition_m <- ifelse(BRCA_methylation_all$SUBTYPE == "LumA", "LumA", "other")
test_methylation <- calculate_test(BRCA_methylation_gene, condition_m, "ttest")

# }