% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/DA-edgeR.R
\name{run_edger}
\alias{run_edger}
\title{Perform differential analysis using edgeR}
\usage{
run_edger(
  ps,
  group,
  confounders = character(0),
  contrast = NULL,
  taxa_rank = "all",
  method = c("LRT", "QLFT"),
  transform = c("identity", "log10", "log10p"),
  norm = "TMM",
  norm_para = list(),
  disp_para = list(),
  p_adjust = c("none", "fdr", "bonferroni", "holm", "hochberg", "hommel", "BH", "BY"),
  pvalue_cutoff = 0.05,
  ...
)
}
\arguments{
\item{ps}{ps a \code{\link[phyloseq:phyloseq-class]{phyloseq::phyloseq}} object.}

\item{group}{character, the variable to set the group, must be one of
the var of the sample metadata.}

\item{confounders}{character vector, the confounding variables to be adjusted.
default \code{character(0)}, indicating no confounding variable.}

\item{contrast}{this parameter only used for two groups comparison while
there are multiple groups. For more please see the following details.}

\item{taxa_rank}{character to specify taxonomic rank to perform
differential analysis on. Should be one of
\code{phyloseq::rank_names(phyloseq)}, or "all" means to summarize the taxa by
the top taxa ranks (\code{summarize_taxa(ps, level = rank_names(ps)[1])}), or
"none" means perform differential analysis on the original taxa
(\code{taxa_names(phyloseq)}, e.g., OTU or ASV).}

\item{method}{character, used for differential analysis, please see details
below for more info.}

\item{transform}{character, the methods used to transform the microbial
abundance. See \code{\link[=transform_abundances]{transform_abundances()}} for more details. The
options include:
\itemize{
\item "identity", return the original data without any transformation
(default).
\item "log10", the transformation is \code{log10(object)}, and if the data contains
zeros the transformation is \code{log10(1 + object)}.
\item "log10p", the transformation is \code{log10(1 + object)}.
}}

\item{norm}{the methods used to normalize the microbial abundance data. See
\code{\link[=normalize]{normalize()}} for more details.
Options include:
\itemize{
\item "none": do not normalize.
\item "rarefy": random subsampling counts to the smallest library size in the
data set.
\item "TSS": total sum scaling, also referred to as "relative abundance", the
abundances were normalized by dividing the corresponding sample library
size.
\item "TMM": trimmed mean of m-values. First, a sample is chosen as reference.
The scaling factor is then derived using a weighted trimmed mean over
the differences of the log-transformed gene-count fold-change between
the sample and the reference.
\item "RLE", relative log expression, RLE uses a pseudo-reference calculated
using the geometric mean of the gene-specific abundances over all
samples. The scaling factors are then calculated as the median of the
gene counts ratios between the samples and the reference.
\item "CSS": cumulative sum scaling, calculates scaling factors as the
cumulative sum of gene abundances up to a data-derived threshold.
\item "CLR": centered log-ratio normalization.
\item "CPM": pre-sample normalization of the sum of the values to 1e+06.
}}

\item{norm_para}{arguments passed to specific normalization methods. Most
users will not need to pass any additional arguments here.}

\item{disp_para}{additional arguments passed to \code{\link[edgeR:estimateDisp]{edgeR::estimateDisp()}}
used for dispersions estimation. Most users will not need to pass any
additional arguments here.}

\item{p_adjust}{method for multiple test correction, default \code{none},
for more details see \link[stats:p.adjust]{stats::p.adjust}.}

\item{pvalue_cutoff}{numeric, p value cutoff, default 0.05}

\item{...}{extra arguments passed to the model. See \code{\link[edgeR:glmQLFTest]{edgeR::glmQLFit()}}
and \code{\link[edgeR:glmfit]{edgeR::glmFit()}} for more details.}
}
\value{
a \code{\linkS4class{microbiomeMarker}} object.
}
\description{
Differential expression analysis based on the Negative Binomial distribution
using \strong{edgeR}.
}
\details{
\strong{Note} that edgeR is designed to work with actual counts. This means that
transformation is not required in any way before inputting them to edgeR.

There are two test methods for differential analysis in \strong{edgeR},
likelihood ratio test (LRT) and quasi-likelihood F-test (QLFT). The QLFT
method is recommended as it allows stricter error rate control by
accounting for the uncertainty in dispersion estimation.

\code{contrast} must be a two length character or \code{NULL} (default). It is only
required to set manually for two groups comparison when there are multiple
groups. The order determines the direction of comparison, the first element
is used to specify the reference group (control). This means that, the first
element is the denominator for the fold change, and the second element is
used as baseline (numerator for fold change). Otherwise, users do required
to concern this parameter (set as default \code{NULL}), and if there are
two groups, the first level of groups will set as the reference group; if
there are multiple groups, it will perform an ANOVA-like testing to find
markers which difference in any of the groups.
}
\examples{
data(enterotypes_arumugam)
ps <- phyloseq::subset_samples(
    enterotypes_arumugam,
    Enterotype \%in\% c("Enterotype 3", "Enterotype 2")
)
run_edger(ps, group = "Enterotype")
}
\references{
Robinson, Mark D., and Alicia Oshlack. "A scaling normalization method for
differential expression analysis of RNA-seq data." Genome biology 11.3
(2010): 1-9.

Robinson, Mark D., Davis J. McCarthy, and Gordon K. Smyth. "edgeR: a
Bioconductor package for differential expression analysis of digital
gene expression data." Bioinformatics 26.1 (2010): 139-140.
}
\seealso{
\code{\link[edgeR:glmfit]{edgeR::glmFit()}},\code{\link[edgeR:glmQLFTest]{edgeR::glmQLFit()}},\code{\link[edgeR:estimateDisp]{edgeR::estimateDisp()}}
,\code{\link[=normalize]{normalize()}}
}
\author{
Yang Cao
}
