AnnotationProcessor
AnnotationProcessor
Public fields
QCis it a QC run
prefixname for one factor designs
repeatedis it a repeated measurement
SAINTis it a AP MS experiment, then use Bait_ as prefix
file_patterncolnames for file
grouping_patterncolnames grouping variable
subject_patterncolnames for pairing variable
control_patterncontrast specification columns
control_col_patterncolumns which contains C or T.
sample_name_patternsample name column
norm_value_patternnormalization value column (e.g., Creatinine)
strictshould name check be strict
Methods
Method new()
initialize
Usage
AnnotationProcessor$new(
QC = FALSE,
prefix = "G_",
repeated = TRUE,
SAINT = FALSE
)Method read_annotation()
read annotation
Method extract_contrasts()
check annotation
Method add_contrasts_vec()
add vector of contrasts to annot table
Examples
# AnnotationProcessor$debug("read_annotation")
ap <- AnnotationProcessor$new(prefix = "G_")
annot <- data.frame(
file = c("a1.raw","a2.raw","a3.raw","a4.raw"),
group = c("a","a","b","b"),
CONTROL = c("C","C","T","T"),
Subject = c("X","Y","X","Y"))
ap$check_annotation(annot)
#> Warning: column starting with :^name is missing.
af <- annot
af$file <- NULL
testthat::expect_error(ap$check_annotation(af), "column starting with :")
af <- annot
af$group <- NULL
testthat::expect_error(ap$check_annotation(af),"column starting with :")
#> Warning: column starting with :^name is missing.
aa <- ap$read_annotation(annot)
#> Warning: column starting with :^name is missing.
#> Registered S3 method overwritten by 'prolfqua':
#> method from
#> print.pheatmap pheatmap
#> INFO [2026-02-25 16:35:40] levels: c("a", "b") c("C", "T")
#> b a
stopifnot(length(aa$atable$factor_keys_depth()) == 2)
stopifnot(all(c("atable", "annot", "contrasts") %in% names(aa)))
stopifnot(aa$contrasts == "G_b - G_a")
af <- annot
af$CONTROL <- NULL
testthat::expect_error(ap$check_annotation(af),"you must specify a CONTROL column")
#> Warning: column starting with :^name is missing.
af <- annot
af$Subject <- NULL
testthat::expect_warning(ap$check_annotation(af),"column starting with")
# should not throw exception since QC does not require group or subject
ap <- AnnotationProcessor$new(QC = TRUE)
af <- annot
# af$group <- NULL
af$CONTROL <- NULL
af$Subject <- NULL
ap$check_annotation(af)
#> Warning: column starting with :^name is missing.
aa <- ap$read_annotation(af)
#> Warning: column starting with :^name is missing.
stopifnot(aa$atable$factor_keys() == "G_")
stopifnot(aa$atable$factors == "group")
aa <- ap$read_annotation(annot)
#> Warning: column starting with :^name is missing.
aa$atable$fileName
#> [1] "file"
aa$atable$sampleName
#> [1] "sampleName"
as <- annot
as$sample <- c("s1","s2","s3","s4")
aa <- ap$read_annotation(annot)
#> Warning: column starting with :^name is missing.
aa$atable$sampleName
#> [1] "sampleName"
stopifnot(is.null(aa$annotation))
annot <- data.frame(
file = c("a1.raw","a2.raw","a3.raw","a4.raw"),
Name = c("a1.raw","a2.raw","a3.raw","a4.raw"),
"Grouping Var" = c("a","a","b","b"),
CONTROL = c("C","C","T","T"),
Subject = c("X","Y","X","Y"))
ax <- ap$read_annotation(annot)