expDiff: Differential expression analysis

View source: R/expDiff.R

expDiffR Documentation

Differential expression analysis

Description

This function returns the differentially expressed genes when comparing two conditions.

Usage

expDiff(
  exp,
  anno = NULL,
  conditions = NULL,
  lfc = 1.5,
  padj = 0.05,
  diffMethod = "Reverter"
)

Arguments

exp

Count data where the rows are genes and coluns the samples.

anno

A single column dataframe. The column name must be 'cond', and the rownames must be the names of samples.

conditions

A character vector containing the name of the two conditions. The first name will be selected as reference.

lfc

log2 fold change module threshold to define a gene as differentially expressed (default: 1.5).

padj

Significance value to define a gene as differentially expressed (default: 0.05).

diffMethod

Choose between Reverter or DESeq2 method (default: 'Reverter'). The DESeq2 method is only for counts data (see details).

Details

The Reverter option to diffMethod parameter works as follows:

  1. Calculation of mean between samples of each condition for all genes;

  2. Subtraction between mean of control condition relative to other condition;

  3. Calculation of variance of subtraction previously obtained;

  4. The last step calculates the differential expression using the following formula, where x is the result of substraction (item 2) and var is the variance calculated in item 3:

    diff = \frac{x - (sum(x)/length(x))}{√{var}}

The DESeq2 option to diffMethod parameter is recommended only for count data. This method apply the differential expression analysis based on the negative binomial distribution (see DESeq).

Value

Returns an list with all calculations of differentially expressed genes and the subsetted differentially expressed genes by lfc and/or padj.

References

REVERTER, Antonio et al. Simultaneous identification of differential gene expression and connectivity in inflammation, adipogenesis and cancer. Bioinformatics, v. 22, n. 19, p. 2396-2404, 2006. https://academic.oup.com/bioinformatics/article/22/19/2396/240742

Examples

# loading a simulated counts data
data('simCounts')

# creating the dataframe with annotation for each sample
anno <- data.frame(cond = c(rep('cond1', 10), rep('cond2', 10)))

# renaming colums of simulated counts data
colnames(simCounts) <- paste(colnames(simCounts), anno$cond, sep = '_')

# renaming anno rows
rownames(anno) <- colnames(simCounts)

# performing differential expression analysis using Reverter method
out <- expDiff(exp = simCounts,
               anno = anno,
               conditions = c('cond1', 'cond2'),
               lfc = 2,
               padj = 0.05,
               diffMethod = 'Reverter')


cbiagii/ceTF documentation built on Feb. 6, 2023, 9:05 p.m.