Converts the protein-level output of MSstats::dataProcess() (label-free) or MSstatsTMT::proteinSummarization() (TMT) into a DEprot object. Contrary to import.external, which parses the reports written on disk by the search engines, this function takes an R object that has already been summarized, normalized and log-transformed by MSstats. The object is then built by load.counts2.

import.msstats(
  object,
  metadata = NULL,
  type = "auto",
  protein.id = "auto",
  sample.id = "auto",
  sample.sep = "_",
  log.base = 2,
  annotation.columns = "auto",
  column.id = "column.id",
  data.type = "auto",
  clean.sample.names = TRUE,
  subset.to.metadata = TRUE,
  verbose = TRUE
)

Arguments

object

The list returned by dataProcess() / proteinSummarization(), the ProteinLevelData (or legacy RunlevelData) data.frame alone, or the path to an .rds file containing either of them.

metadata

A data.frame (or path to a table) containing at least the column indicated by column.id. If NULL (default) the metadata are reconstructed from the annotation columns carried by the MSstats object itself (conditions, replicates, mixtures, channels).

type

String indicating the flavour of the input: "auto" (default), "lfq" (MSstats) or "tmt" (MSstatsTMT).

protein.id

String indicating the column to use as protein identifier. Default "auto".

sample.id

Character vector indicating the column(s) whose combination identifies a sample. Default "auto" uses originalRUN for label-free data and Run + Channel for TMT, which is the only combination guaranteed to be unique across mixtures and technical replicates.

sample.sep

String used to paste multiple sample.id columns. Default "_".

log.base

Number indicating the base of the logarithm of the summarized abundances. Default 2. Set it to 10 if dataProcess() was run with logTrans = 10.

annotation.columns

Character vector of the columns to carry into the automatically generated metadata. Default "auto" keeps the MSstats annotation columns that are constant within each sample.

column.id

String indicating the metadata column matching the sample names. Default "column.id".

data.type

String, one among "auto" (default), "raw", "normalized", "randomized", "imputed". See 'Details' for how "auto" decides.

clean.sample.names

Logical, whether to strip paths and raw-file extensions from the run names. Default TRUE.

subset.to.metadata

Logical, whether to keep only the samples listed in the metadata. Default TRUE.

verbose

Logical, whether to print progress messages. Default TRUE.

Value

A DEprot object (S4 vector).

Details

No package is required to read these objects: they are ordinary data.frames, so neither MSstats nor MSstatsTMT needs to be installed for the import itself.

MSstats abundances are already log-transformed, therefore the zero-to-NA conversion applied to linear intensities is skipped here: a summarized abundance of 0 is a legitimate value.

With data.type = "auto" the label-free data are loaded as "imputed" when the column NumImputedFeature is present and contains non-zero values, since that column only appears when dataProcess() was run with MBimpute = TRUE; otherwise they are loaded as "normalized". TMT data are always loaded as "normalized", because proteinSummarization() applies global_norm and reference_norm by default and its protein-level table carries no indicator of the accelerated-failure-time imputation. Set data.type = "imputed" explicitly if MBimpute = TRUE was used.

A note on TMT data

DEprot is designed for label-free quantitation. TMT data can be loaded and analysed, but several assumptions of the package do not hold: the missingness is structured by mixture rather than by sample, the fold changes are compressed by co-isolation, and the data have already been normalized within and between plexes by MSstatsTMT. Re-normalizing with normalize.counts or re-imputing with impute.counts is therefore discouraged. The mixture effect can instead be handled with harmonize.batches, using the Mixture column of the generated metadata as batch variable.

Author

Sebastian Gregoricchio

Examples

if (FALSE) { # \dontrun{
# label-free (MSstats)
summarized <- MSstats::dataProcess(raw)
dpo <- import.msstats(object = summarized)

# TMT (MSstatsTMT)
summarized.tmt <- MSstatsTMT::proteinSummarization(input.pd)
dpo <- import.msstats(object = summarized.tmt,
                      type = "tmt",
                      data.type = "imputed")

# correcting the mixture (plex) effect of a TMT experiment
dpo <- harmonize.batches(DEprot.object = dpo, batch.column = "Mixture")
} # }