perform_anova_gen: A Function Performs Differential Expression Analysis Based On...

View source: R/utils.R

perform_anova_genR Documentation

A Function Performs Differential Expression Analysis Based On ANOVA

Description

This function peforms an ANOVA for each probe/gene (lines) across confditions (colums) of a data matrix. It returns a dataframe that includes many metrics as a results (betas, p-values, ...). Genes are indexed by 'g' in 'G', conditions are indexed by 'h' in 'H' (histology, sex...) and samples are indexed by 'i' in 'I'. For each gene 'g':

  • we compute a linear model of the level of expression value according to histological groups: 'log2(exprs_g, i) = beta_g, h + epsilon_g, i'.

  • we perform ANOVA test on this model and harvest corresponding p-value

  • we extract of each group: 'beta_g, h = fracsum_g in G mean(log2(exprs_g,i))|G| - mean(log2(exprs_g,i))'

  • we compute corresponding logratio scores: 'logratio_g, h = (1 + frac1/|H| - 1) beta_g, h'

  • we compute corresponding foldchange scores using 'gtools::foldchange2logratio' function

These values are retruned as a dataframe which fields are:

  • probename: the name of the corresponding probe

  • ad_pval: the result of the Anderson-Darling normality test (hypothesis for ANOVA)

  • intercept: the mean of means of each group

  • beta_hhh_FFF: the previously describe beta value for the factor 'FFF' of the experimental grouping field 'hhh'

  • logratio_hhh_FFF : the previously describe logratio value for the factor 'FFF' of the experimental grouping field 'hhh'

  • foldchange_hhh_FFF: the previously describe foldchange value for the factor 'FFF' of the experimental grouping field 'hhh'

  • pval_hhh: the p-value associated to the ANOVA test

  • adj_pval_hhh: the adjusted p-value associated to the ANOVA test using Benjamini-Hochberg procedure to the threshold of 0.05.

Usage

perform_anova_gen(design, model, data, key = NULL,
  MONITORED_APPLY = FALSE, AD_TEST = TRUE)

Arguments

design

A dataframe that describes the design of the experiment.

model

A model describe the test to apply.

data

A matrix of exrpression values for probe/gene (lines) and confditions (colums).

key

A character string that will suffix the column names of the resulting data frame

MONITORED_APPLY

A boolean set to TRUE if we want to monitor the loop on lines (usefull for debugging).

AD_TEST

A boolean set to TRUE if we want to perform normality test.


fchuffar/epimedtools documentation built on Feb. 3, 2024, 2:21 a.m.