% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/de_plots.R
\name{diff_expr_ma_plot}
\alias{diff_expr_ma_plot}
\title{Function to generate a M-A plot using `ggplot2`}
\usage{
diff_expr_ma_plot(
  dat,
  contr,
  id = NULL,
  sym.col = "gene_symbol",
  p.thr = 0.05,
  fdr.thr = 0.05,
  logfc.thr = 1,
  numlab = 25,
  out.dir,
  analysis.name = NULL,
  point.lab = TRUE,
  biom.attributes = c("ensembl_gene_id", "hgnc_symbol", "description"),
  font.size = 5,
  lists = TRUE,
  base.size = 16
)
}
\arguments{
\item{dat}{data frame; annotated output table generated by performing pair-wise comparisons and
corresponding statistical tests.}

\item{contr}{Character; contrast to be processed. This is either a column name of a contrast matrix or a character
conforming to the same format.}

\item{id}{\code{character}. Name of the column with the IDs used for labeling. Used as fallback for \code{sym.col}.}

\item{sym.col}{\code{character}. Name of the column with the IDs used for labeling. Takes priority over \code{id}.}

\item{p.thr}{Numeric; P-Value threshold for filtering gene labels. Only genes (points) with a value below this threshold will be labeled.}

\item{fdr.thr}{Numeric; FDR threshold for filtering gene labels (see \code{p.thr}).}

\item{logfc.thr}{Numeric; FC threshold on the log2-scale for filtering gene labels.}

\item{numlab}{\code{numeric}. Maximum number of labels per plot. Overrides numbers calculated based on `p.thr` and `fdr.thr`.}

\item{out.dir}{Character; output directory for final tables. Required; no default is used so that nothing is written to the working directory unintentionally.}

\item{analysis.name}{Character used in the output file name.}

\item{point.lab}{\code{logical}. Should points be labelled, at all?}

\item{biom.attributes}{\code{character}. Vector of column names to be retrieved from biomart.}

\item{font.size}{Size of point labels in M-A plots.}

\item{lists}{Logical; should output tables be written to files?}

\item{base.size}{\code{numeric}. Overall text scale (`ggplot2` \code{base_size}, default 16) applied via
\code{theme_gray}; controls legend, axis and title text. Independent of \code{font.size}, which sets the
point-label size. Raise it for readability on a large device (e.g. the 15x15 inch pipeline PDF).}
}
\value{
A named \code{list} of \code{ggplot} objects with the elements \code{FDR} and \code{Pval},
  holding the M-A plot with points highlighted by false discovery rate and by p-value, respectively.
}
\description{
Function to generate a M-A plot using `ggplot2`
}
\examples{
\donttest{
set.seed(1)
d3 <- data.frame(gene_symbol = paste0("G", 1:100),
                 logFC = rnorm(100), PValue = runif(100), FDR = runif(100),
                 AveExpr = rnorm(100, 5))
rownames(d3) <- d3$gene_symbol
g <- diff_expr_ma_plot(d3, contr = "treated-control", sym.col = "gene_symbol",
                       out.dir = tempdir(), lists = FALSE)
names(g)
}
}
