% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generateRef.R
\name{generateRef}
\alias{generateRef}
\title{Generate Reference Signature Matrix}
\usage{
generateRef(dds, pheno, FDR = 0.05, dat, method = "limma")
}
\arguments{
\item{dds}{Matrix. Raw count data from RNA-seq. Required if
`method = "DESeq2"`.}

\item{pheno}{Character vector. Cell type class of the samples.}

\item{FDR}{Numeric. Genes with BH adjusted p-value < FDR are considered
significant. Default is 0.05.}

\item{dat}{Matrix or data frame. Normalized transcript quantification data
(e.g., FPKM, TPM).}

\item{method}{Character. Method for differential expression: `"limma"` or
`"DESeq2"`. Default is `"limma"`.}
}
\value{
List containing:
  - `reference_matrix`: Data frame of median expression for significant
    genes across cell types.
  - `G`: Optimal number of probes minimizing condition number.
  - `condition_number`: Minimum condition number.
  - `whole_matrix`: Full median expression matrix.
}
\description{
Generates a reference signature matrix for cell types based on
differential expression analysis. Supports both limma for normalized data
and DESeq2 for raw count data.
}
\examples{
expressionData <- matrix(runif(1000 * 4, min = 0, max = 10), ncol = 4)
rownames(expressionData) <- paste("Gene", 1:1000, sep = "_")
colnames(expressionData) <- paste("Sample", 1:4, sep = "_")

phenotype <- c("celltype1", "celltype2", "celltype1", "celltype2")

rawCountData <- matrix(sample(1:100, 1000 * 4, replace = TRUE), ncol = 4)
rownames(rawCountData) <- paste("Gene", 1:1000, sep = "_")
colnames(rawCountData) <- paste("Sample", 1:4, sep = "_")

\donttest{
result <- generateRef(
  dds = rawCountData, pheno = phenotype,
  FDR = 0.05, dat = expressionData, method = "DESeq2"
)
}
}
