% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/main.R
\name{find.discriminant.genes}
\alias{find.discriminant.genes}
\title{Find discriminant genes}
\usage{
find.discriminant.genes(
  ref,
  query,
  query.control = NULL,
  ref.assay = "RNA",
  query.assay = "RNA",
  state = "largest",
  labels.col = "functional.cluster",
  test = "wilcox",
  min.cells = 10,
  genes.use = c("variable", "all"),
  ...
)
}
\arguments{
\item{ref}{Seurat object with reference atlas}

\item{query}{Seurat object with query data}

\item{query.control}{Optionally, you can compare your query with a control sample, instead of the reference}

\item{ref.assay}{The referece assay to be used for DE analysis}

\item{query.assay}{The query assay to be used for DEG analyis, if comparing to the reference}

\item{state}{Perform discriminant analysis on this cell state. Can be either:
\itemize{
  \item{"largest" - Performs analysis on the cell state most represented in the query set(s)}
  \item{"all" - Performs analysis on the complete dataset, using all cells}
  \item{A specific cell state, one of the states in metadata field labels.col}
}}

\item{labels.col}{The metadata field used to annotate the clusters (default: functional.cluster)}

\item{test}{Type of test for DE analysis. See help for `FindMarkers` for implemented tests.}

\item{min.cells}{Minimum number of cells in the cell type to proceed with analysis.}

\item{genes.use}{What subset of genes to consider for DE analysis:
\itemize{
  \item{"variable" - Only consider variable genes of the reference}
  \item{"all" - Use intersection of all genes in query and control}
  \item{A custom list of genes}
}}

\item{...}{Adding parameters for `FindMarkers`}
}
\value{
A dataframe with a ranked list of genes as rows, and statistics as columns (e.g. log fold-change, p-values). See help for `FindMarkers` for more details.
}
\description{
Based on `FindMarkers`. It performs differential expression analysis between a projected query and a control (either the reference map or a control sample), for
a given cell type. Useful to detect whether specific cell states over/under-express genes between conditions or with respect to the reference.
}
\examples{
# Discriminant genes between query and reference in cell type "Tex"
markers <- find.discriminant.genes(ref, query=query.set, state="Tex")

# Discriminant genes between query and control sample in most represented cell type
markers <- find.discriminant.genes(ref, query=query.set, query.control=control.set)

# Pass results to EnhancedVolcano for visual results
library(EnhancedVolcano)
EnhancedVolcano(markers, lab = rownames(markers), x = 'avg_logFC', y = 'p_val')

}
