% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/feature_selection.R
\name{limma.dif}
\alias{limma.dif}
\title{Differential Expression Analysis Using Limma}
\usage{
limma.dif(exprdata, pdata, contrastfml)
}
\arguments{
\item{exprdata}{A matrix with rownames as features like gene symbols or cgi, and colnames as samples.}

\item{pdata}{A two-column dataframe where the first column matches the colnames of exprdata and the second column contains the grouping variable.}

\item{contrastfml}{A character vector for contrasts to be tested (see ?makeContrasts for more details).}
}
\value{
Returns a dataframe from limma::topTable, which includes genes as rows and columns like genelist, logFC, AveExpr, etc.
}
\description{
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.
}
\examples{
# 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)
}
