% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dge_analysis.R
\name{run_deseq2}
\alias{run_deseq2}
\title{Perform DGE analysis}
\usage{
run_deseq2(
  counts,
  pd,
  id_col = NULL,
  cond_col,
  cond_levels = NULL,
  lfc_threshold = 0,
  sig_threshold = 0.01,
  dge_calling_strategy = "bulk",
  subset_feature = NULL,
  subset_sample = NULL,
  deseq_opts = list(),
  lfc_shrink_opts = list(),
  return_dds = FALSE,
  BPPARAM = BiocParallel::SerialParam()
)
}
\arguments{
\item{counts}{Can be either:
\enumerate{
\item (sparse) matrix with gene counts, where the rows correspond to genes. One column per sample/cell with the count data for the specified genes must be present (The names of these columns must match with the identifiers in \code{id_col}).
\item An results object from tximport (preferred if \code{\link[=import_dge_counts]{import_dge_counts()}} was used with bulk data).
\item Seurat object with a gene level assay as \code{active.assay} (most likely result object from \code{\link[=combine_to_matrix]{combine_to_matrix()}})
}}

\item{pd}{Data frame with at least a column of sample/cell identifiers (rownames or specified in \code{id_col}) and the comparison group definition (specified in \code{cond_col}).}

\item{id_col}{Name of the column in \code{pd}, where unique sample/cell identifiers are stored. If \code{NULL} (default), use rownames of \code{pd}.}

\item{cond_col}{Name of the column in \code{pd}, where the comparison groups/conditions are defined. If more than 2 levels/groups are present, the groups that should be used must be specified in \code{cond_levels}.}

\item{cond_levels}{Define two levels/groups of \code{cond_col}, that should be compared. The order of the levels states the comparison formula (i.e. \code{cond_col[1]-cond_col[2]}).}

\item{lfc_threshold}{Specify a log2 fold change threshold (on log2 scale) to test against. 0 implicates no threshold.}

\item{sig_threshold}{Specify a significance threshold for the results adjusted p-values or s-values. 1 implicates no threshold.}

\item{dge_calling_strategy}{Should be either 'bulk' or 'sc'. Specify the type of the provided data (bulk or single-cell RNA-seq) so that appropriate parameters can be applied.}

\item{subset_feature}{Subsets the provided count matrix to only specified features. Can be names, indices or logicals.}

\item{subset_sample}{Subsets the provided count matrix to only specified samples. Can be names, indices or logicals.}

\item{deseq_opts}{Manually specify parameters for the \code{\link[DESeq2:DESeq]{DESeq}} function. Will overwrite recommended parameters if necessary.}

\item{lfc_shrink_opts}{Manually specify parameters for the \code{\link[DESeq2:lfcShrink]{lfcShrink}} function. Will overwrite recommended parameters if necessary.}

\item{return_dds}{Should the DESeqDataSet object be returned?}

\item{BPPARAM}{If multicore processing should be used, specify a \code{BiocParallelParam} object here. Among others, can be \code{SerialParam()} (default) for non-multicore processing or \code{MulticoreParam('number_cores')} for multicore processing. See \code{\link[BiocParallel:BiocParallel-package]{BiocParallel}} for more information.}
}
\value{
A list with the analysis results and parameters:
\itemize{
\item \code{results_all}: Data frame of the DGE test results for all analyzed genes.
\item \code{results_sig}: Data frame of the significant DEG test results, according to the specified parameters (\code{sig_threshold}, \code{lfc_threshold}).
\item \code{dds}: The DESeqDataSet of the analysis, if \code{return_dds=TRUE}.
\item \code{drim}: Results of the DRIMSeq statistical computations (\code{dmTest()}).
\item \code{sval_threshold / adjp_threshold}: The given significance threshold used to either filter s-values or adjusted p-values.
\item \code{comparison}: A string representation of the performed comparison.
\item \code{condition1}: The first condition of the performed comparison.
\item \code{condition2}: The second condition of the performed comparison.
\item \code{sample_table}: The (filtered) sample table (\code{pd}) - including the \code{condition} column used for comparison.
\item \code{deseq_opts}: A list of used \code{\link[DESeq2:DESeq]{DESeq}} parameters.
\item \code{lfc_shrink_opts}: A list of used \code{\link[DESeq2:lfcShrink]{lfcShrink}} parameters.
}
}
\description{
Perform differential gene expression analysis with DESeq2
}
\details{
Offers functionality to perform a DGE analysis for bulk and single-cell data with DESeq2, automatically applying recommended models and parameter settings.
It is strongly advised to provide 'raw' count data, as imported with \code{\link[=import_dge_counts]{import_dge_counts()}}.
Installation of package 'apeglm' is recommended for LFC-shrinkage, for single-cell data the package 'glmGamPoi' is additionally recommended.
For questions about DESeq2, LFC-shrinkage or s-values, please refer to the excellent \href{http://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html}{DESeq2 vignette}.
}
\seealso{
\code{\link[=import_dge_counts]{import_dge_counts()}} for correct import of gene-level counts. \code{\link[=combine_to_matrix]{combine_to_matrix()}} to summarize scRNA counts to one matrix.

Other DTUrtle DGE: 
\code{\link{import_dge_counts}()}
}
\concept{DTUrtle DGE}
