View source: R/feature_selection.R
| limma.dif | R Documentation |
Performs differential expression analysis using the limma package on a given gene expression dataset. Constructs a design matrix from phenotype data, fits a linear model, applies contrasts, and computes statistics for differential expression.
limma.dif(exprdata, pdata, contrastfml)
exprdata |
A matrix with rownames as features like gene symbols or cgi, and colnames as samples. |
pdata |
A two-column dataframe where the first column matches the colnames of exprdata and the second column contains the grouping variable. |
contrastfml |
A character vector for contrasts to be tested (see ?makeContrasts for more details). |
Returns a dataframe from limma::topTable, which includes genes as rows and columns like genelist, logFC, AveExpr, etc.
# Toy example with 100 genes and 6 samples
set.seed(123)
exprdata <- matrix(
rnorm(100 * 6),
nrow = 100,
ncol = 6,
dimnames = list(
paste0("gene", 1:100),
paste0("sample", 1:6)
)
)
# Phenotype data: 3 vs 3
pdata <- data.frame(
sample = colnames(exprdata),
group = rep(c("group1", "group2"), each = 3),
stringsAsFactors = FALSE
)
# Differential expression: group1 vs group2
res <- limma.dif(
exprdata = exprdata,
pdata = pdata,
contrastfml = "group1 - group2"
)
head(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.