Interactively build the metadata, design matrix, and contrast matrix for a DEA workflow. Run after load-peptide-quant-data and before any DEA step.
Interactively walk the user through their experimental structure and produce the meta, design, and contrast.matrix objects required by DEA workflows.
dat must exist in the R session. If it does not, tell the user to run load-peptide-quant-data first and stop.
Call r.execute with code: "colnames(dat$E)" to retrieve the run/sample identifiers.
Present them to the user for review.
Ask the user which samples belong to which condition. Accept either:
read.csv / read.delim and extract the Condition columnOnce you have the mapping, construct meta as a data frame with at minimum:
Run: colnames of dat$E (in order)Condition: condition label for each runAsk whether any blocking variables are present (donor, batch, sex, etc.).
If yes, either parse them from sample names or ask the user to provide them.
Add as additional columns to meta.
Execute R code to:
meta$Condition <- factor(meta$Condition)
design <- model.matrix(~0 + Condition, data = meta)
colnames(design) <- gsub("^Condition", "", colnames(design))
If covariates were provided, add them to the formula (e.g. ~0 + Condition + Batch).
Assign meta and design to .GlobalEnv.
Ask the user which pairwise comparisons to make (e.g. "ALS vs CTRL"). Execute R code (limma) to construct the contrast matrix, e.g.:
library(limma)
contrast.matrix <- makeContrasts(ALS - CTRL, levels = design)
Assign contrast.matrix to .GlobalEnv.
Print the design matrix and contrast matrix back to the user so they can verify before proceeding to a DEA step.
r.execute call per step where possibleRun and Condition columns; warn if column names differ"Condition" prefix) so contrast syntax is readablemeta, design, and contrast.matrix are set in .GlobalEnv and ready for any DEA workflow skill