Skip to contents

The inverse of LFQData$data_wide(): feature x sample matrices, their row annotation and their sample annotation back to long-format LFQData. Row i of every matrix belongs to row i of rowdata; matrix column names are the sample names.

Usage

lfqdata_from_wide(values, rowdata, annotation, config, prefix = "ms")

Arguments

values

a matrix (features in rows, samples in columns), stored under config$get_response(), or a named list of such matrices with identical dimensions, row names and column names; list names are the value columns

rowdata

data.frame with one row per matrix row and the hierarchy key columns, which must identify each row uniquely

annotation

data.frame with one row per sample: config$sample_name plus the file name and factor columns

config

AnalysisConfiguration describing the result

prefix

prefix passed to LFQData

Value

LFQData

Examples

dd <- prolfqua::sim_lfq_data_peptide_config()
#> `protein_Id`: columns `proteinID`, `idtype2` united with separator '~'.
#> creating sampleName from file_name column
#> setup_analysis: dropped 6 unconfigured columns: average_prot_abundance, sd, mean, N, avg_peptide_abd, Replicate.
#> setup_analysis: added 36 rows with NA response for feature and sample combinations absent from the input.
lfqdata <- prolfqua::LFQData$new(dd$data, dd$config)
wide <- lfqdata$data_wide(as.matrix = TRUE)
back <- lfqdata_from_wide(wide$data, wide$rowdata, wide$annotation, lfqdata$get_config())
stopifnot(nrow(back$data_long()) == nrow(lfqdata$data_long()))