LimmaFn: Do differential gene expression

Description Usage Arguments Details Value See Also Examples

View source: R/LimmaFn.R

Description

LimmaFn uses functions in limma package to easily compute the moderated t-statistics and p-values from differential gene expression tests comparing between different phenotypes even when sample size is small.

Usage

1
LimmaFn(pheno.v, data.m)

Arguments

pheno

A vector of sample phenotypes. Sample phenotype in a scientific research could be treatment/control, normal/cancer or smoker/non-smoker. Different phenotypes could each be encoded as 0/1 when inputting to LimmaFn, for example, Normal-0; Cancer-1.

data

A matrix, the unnormalized gene expression dataset, should be a numeric matrix, with rows referring to genes and columns to samples. In this matrix you could use any type of gene IDs, like Entrez ID, Ensembl ID, HUGO gene symbol... But make sure to use the same gene annotation through out your analysis.

Details

This function computes the moderated t-statistic for users using empirical Bayes method, it is especially useful when the sample size is too small to perform parametric tests.

Given a gene expression data matrix and a vector indicating sample phenotype, LimmaFn first fits a linear model using lmFit, then it refits the model and do comparisons between any two different phenotypes with contrasts.fit, finally it estimates moderated t-statistics for each comparison from the fitted model using empirical Bayes method (eBayes) and output the result from the topTable function.

Note that doing the contrasts.fit step will not make a difference if you do comparison between two different sample status (treatment/control). However, When there are more than two sample status in your data set, this step will do comparison between every two status. And resulted summary tables will be stored in a list.

Value

A table with rows for all genes (ranked by significance) and columns of log2 fold-change, average expression, moderated t-statistic, p-value, adjusted p-value (Benjamini–Hochberg procedure). The table is the output of topTable function.

See Also

lmFit for fitting a linear model, contrasts.fit for refitting, eBayes for Bayes method, topTable for the output table.

Examples

1
2
3
4
5
6
# prepare the phenotype info ("C"-control; "T"-treatment)
pheno.v <- c("C","C","C","T","T","T")
# prepare your normalized data matrix.
data.m <- matrix(rnorm(120),nrow=20,ncol=6)
# run function
lim.o <- LimmaFn(pheno.v, data.m)

WangNing0420/SCIRA documentation built on Aug. 5, 2019, 4:11 p.m.