% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/collect-plot-results.R
\name{msqrobCollect}
\alias{msqrobCollect}
\title{Function to collect the inference tables generated by the msqrob2
statistical inference workflow.}
\usage{
msqrobCollect(object, contrast, resultsColumnNamePrefix = "", combine = TRUE)
}
\arguments{
\item{object}{A \code{SummarizedExperiment} object containing model
inference performed by \code{hypothesisTest()}.}

\item{contrast}{A numeric \code{matrix} providing the contrast matrix
used during model estimation or a character \code{vector} providing
the names of the contrast used during model estimation.}

\item{resultsColumnNamePrefix}{A \code{character(1)} providing the
prefix used when running \code{hypothesisTest()}.}

\item{combine}{A \code{logical(1)} indicating whether the result tables
should be combined in a single table (default) or return as a
list of tables. When combined, two new variables are created:
1. \code{contrast}tells from which contrast (column of the \code{contrast}
matrix) the results where obtained; 2. \code{feature} provides the
name of the modelled feature (this information is taken from
the rownames of the tables, but this are made unique upon
combining).}
}
\value{
Result tables for contrasts combined in a single table or list
}
\description{
Function to collect the inference tables generated by the msqrob2
statistical inference workflow.
}
\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)

## Extract Results
inference <- msqrobCollect(pe[["protein"]], L) 
head(inference)

}
