Converts a DEprot/DEprot.analyses object into the container used by other proteomics and Bioconductor workflows: SummarizedExperiment, QFeatures, MSnSet, limma::EList, or a plain list of tables. This is the counterpart of import.external: all the count matrices available in the object become assays, the metadata table becomes the column annotation, and the protein information (together with the differential results, when present) becomes the row annotation.

export.external(
  DEprot.object,
  format = "SummarizedExperiment",
  counts.type = "auto",
  assays = "all",
  add.protein.info = TRUE,
  add.results = TRUE,
  contrast.subset = NULL,
  assay.name = "proteins",
  keep.object = FALSE,
  install.missing = "ask",
  verbose = TRUE
)

Arguments

DEprot.object

An object of class DEprot or DEprot.analyses.

format

String indicating the output container. One among: "SummarizedExperiment" (default), "QFeatures", "MSnSet", "EList", "list".

counts.type

String indicating which counts must be used as primary assay. One among "auto" (default), "raw", "normalized", "randomized", "imputed". When "auto" the most processed matrix available is used.

assays

String or character vector indicating which count matrices should be stored as assays. Default "all" (all the matrices available in the object). Ignored by the formats holding a single matrix (MSnSet, EList).

add.protein.info

Logical, whether the protein.info table of the object, when available, should be added to the row annotation. Default TRUE.

add.results

Logical, whether the differential results should be added to the row annotation (only for DEprot.analyses objects). Default TRUE.

contrast.subset

Numeric vector indicating the contrasts to add to the row annotation. Default NULL (all contrasts).

assay.name

String indicating the name of the assay set in the QFeatures object. Default "proteins".

keep.object

Logical, whether the original DEprot object should be stored in the metadata of the exported container, allowing a lossless round-trip. Default FALSE.

install.missing

String defining the behaviour when an optional package is missing: "ask" (default, prompts in interactive sessions), "always", "never".

verbose

Logical value to indicate whether progress messages should be printed. Default TRUE.

Value

An object of the class indicated by format.

Details

The count matrices are stored as assays named raw, normalized, randomized and imputed, with the one indicated by counts.type placed first so that it becomes the default assay. Since a SummarizedExperiment requires all the assays to share the same dimensions, the matrices are re-indexed on the proteins and samples of the primary assay: proteins removed at a later step of the pipeline (imputation, filtering) are therefore dropped, and any protein missing from a secondary matrix is filled with NA.

The experimental parameters that have no equivalent in the destination class (log base, normalization and imputation methods, contrasts, thresholds) are written in the metadata list of the object, so that nothing is silently lost.

Except for "EList" and "list", which need no additional package, the destination classes come from Bioconductor and are declared as optional dependencies:

SummarizedExperiment

format = "SummarizedExperiment" and "QFeatures"

QFeatures

format = "QFeatures"

MSnbase

format = "MSnSet"

They are requested only when needed and never installed without an explicit confirmation (see install.missing).

Author

Sebastian Gregoricchio

Examples

if (FALSE) { # \dontrun{
# SummarizedExperiment with all the count matrices available
se <- export.external(DEprot.object = DEprot::test.toolbox$dpo.imp,
                      format = "SummarizedExperiment")

# differential results stored in the rowData
se <- export.external(DEprot.object = DEprot::test.toolbox$diff.exp.limma,
                      format = "SummarizedExperiment",
                      add.results = TRUE)

# QFeatures, keeping the original object for a round-trip
qf <- export.external(DEprot.object = dpo,
                      format = "QFeatures",
                      keep.object = TRUE)

# single-matrix containers
ms <- export.external(DEprot.object = dpo, format = "MSnSet")
el <- export.external(DEprot.object = dpo, format = "EList")
} # }