% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/collect-plot-results.R
\name{plotVolcano}
\alias{plotVolcano}
\title{Volcano plot}
\usage{
plotVolcano(
  resultsTable,
  significanceLevel = 0.05,
  significance_colors = c(`FALSE` = "black", `TRUE` = "red"),
  opacity = 0.5
)
}
\arguments{
\item{resultsTable}{data frame returned by the msqrob2 hypothesisTest method}

\item{significanceLevel}{nominal FDR-level at which features are considered
significant (value between 0 and 1)}

\item{significance_colors}{a named vector with two colors, one for
non-significant features named 'FALSE' and one for significant features
named 'TRUE'. The default is 'c('FALSE' = 'black', 'TRUE' = 'red')'.}

\item{opacity}{refers to the opacity of the dots in the plot.
Values of opacity range from 0 to 1, with lower values corresponding to more
transparent colors. The default is \code{opacity = 0.5}.}
}
\value{
A ggplot object with the volcano plot.
}
\description{
\code{plot_volcano} generates a volcano plot for the results of hypothesis
tests generated with the msqrob2 hypothesisTest method.
}
\examples{

# Load example data
# The data are a Feature object containing
# a SummarizedExperiment named "peptide" with MaxQuant peptide intensities
# The data are a subset of spike-in the human-ecoli study
# The variable condition in the colData of the Feature object
# contains information on the spike in condition a-e (from low to high)
data(pe)

# Aggregate peptide intensities in protein expression values 
# Note that the peptide intensities were already normalised!
pe <- aggregateFeatures(pe, 
                        i = "peptide", 
                        fcol = "Proteins", 
                        name = "protein")

# Fit msqrob model
pe <- msqrob(pe, i = "protein", formula = ~condition)

# Define contrast
design <- model.matrix(~condition, data = colData(pe))
# Assess log2 fold change between reference condition a and condition b
L <- makeContrast(
    contrasts = c("conditionb = 0",
                  "conditionc = 0",
                  "conditionc - conditionb = 0"),
    parameterNames = colnames(design))


pe <- hypothesisTest(pe, i = "protein", L)

# Volcano plots
library(ggplot2)
inference <- msqrobCollect(pe[["protein"]], L) 
plotVolcano(inference) + facet_wrap(~contrast)
plotVolcano(rowData(pe[["protein"]])$`conditionc`)
plotVolcano(rowData(pe[["protein"]])$`conditionc - conditionb`)
}
