Setup a tidy table compatible with a AnalysisConfiguration
Source: R/tidyMS_data_setup.R
setup_analysis.RdExtracts columns relevant for a configuration from a data frame and create new columns e.g. sampleName column etc.
Examples
skylineconfig <- AnalysisConfiguration$new()
skylineconfig$file_name <- "Replicate.Name"
skylineconfig$hierarchy[["protein_Id"]] <- "Protein.Name"
skylineconfig$hierarchy[["peptide_Id"]] <- "Peptide.Sequence"
skylineconfig$hierarchy[["precursor_Id"]] <- c("Peptide.Sequence", "Precursor.Charge")
skylineconfig$hierarchy[["fragment_Id"]] <- c(
"Peptide.Sequence", "Precursor.Charge",
"Fragment.Ion", "Product.Charge"
)
skylineconfig$ident_q_value <- "Detection.Q.Value"
skylineconfig$set_response("Area")
skylineconfig$isotope_label <- "Isotope.Label.Type"
skylineconfig$factors[["Time"]] = "Sampling.Time.Point"
sample_analysis <- setup_analysis(prolfqua_data('data_skylinePRMSample_A')$data, skylineconfig)
#> creating sampleName from file_name column
#> Warning: no nr_children column specified in the data, adding column nr_children and setting to 1.
#> completing cases
#> completing cases done
#> setup done
# Example with normValue column (e.g., creatinine)
set.seed(1234)
data <- sim_lfq_data(Nprot = 10, PEPTIDE = TRUE, N = 4)
data$nr_children <- 1
data$isotopeLabel <- "light"
data$qValue <- 0
# Add creatinine values per sample (not per protein/peptide)
sample_creatinine <- data |> dplyr::select(sample) |> dplyr::distinct() |>
dplyr::mutate(creatinine = rnorm(dplyr::n(), mean = 100, sd = 10))
data <- dplyr::inner_join(data, sample_creatinine, by = "sample")
config <- AnalysisConfiguration$new()
config$file_name = "sample"
config$factors["group_"] = "group"
config$hierarchy[["protein_Id"]] = c("proteinID", "idtype2")
config$hierarchy[["peptide_Id"]] = "peptideID"
config$set_response("abundance")
config$norm_value = "creatinine"
adata <- setup_analysis(data, config)
#> creating sampleName from file_name column
#> completing cases
#> completing cases done
#> setup done