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

\item{pheno}{Character vector. Cell type classes for samples.}

\item{FDR}{Numeric. Threshold for adjusted p-values. Default is 0.05.}

\item{dat}{Matrix. Normalized expression data (e.g., FPKM, TPM) for
calculating median expression.}
}
\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{
Uses DESeq2 to perform differential expression analysis across cell types,
identifies significantly expressed genes, and creates a reference signature
matrix from median expression levels.
}
\examples{
set.seed(123)
dds <- matrix(sample(0:1000, 2000, replace = TRUE), nrow = 100, ncol = 20)
colnames(dds) <- paste("Sample", 1:20, sep = "_")
rownames(dds) <- paste("Gene", 1:100, sep = "_")
pheno <- rep(c("Type1", "Type2"), each = 10)
dat <- matrix(runif(2000), nrow = 100, ncol = 20)
rownames(dat) <- rownames(dds)
colnames(dat) <- colnames(dds)
\donttest{
result <- generateRef_DEseq2(dds = dds, pheno = pheno, FDR = 0.05, dat = dat)
print(result$reference_matrix)
}
}
