diff --git a/R/clean_DIANN.R b/R/clean_DIANN.R index 38cea27b..ef0e9460 100644 --- a/R/clean_DIANN.R +++ b/R/clean_DIANN.R @@ -243,6 +243,12 @@ #' parenthetical annotation is stripped out of \code{PeptideSequence}, #' leaving the plain amino acid sequence. #' +#' Peptides with two or more labelable residues are dropped, counting across +#' all of \code{labeledAminoAcids} combined, since partial labeling is not +#' supported by the turnover model. This applies only to the +#' \code{ModifiedSequence} path; channel-based labeling is not inferred from +#' sequence content and is left untouched. +#' #' @param dn_input \code{data.table} after column renaming. #' @param labeledAminoAcids Character vector of single-letter amino acid codes #' (e.g. \code{c("K")} or \code{c("K", "R")}), or \code{NULL} to skip @@ -274,6 +280,8 @@ light_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-L\\)") strip_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-[HL]\\)") + dn_input <- .filterMultiplyLabeledPeptides(dn_input, aa_pattern, + "\\([^)]*\\)") dn_input <- .classifyIsotopeLabelType(dn_input, heavy_regex, light_regex) dn_input[, PeptideSequence := gsub(strip_regex, "", PeptideSequence, perl = TRUE)] } diff --git a/R/clean_Spectronaut.R b/R/clean_Spectronaut.R index 48b4287d..ac46a6f1 100644 --- a/R/clean_Spectronaut.R +++ b/R/clean_Spectronaut.R @@ -179,19 +179,27 @@ #' #' In Spectronaut protein turnover reports, heavy peptides appear in #' \code{FG.LabeledSequence} with a bracketed modification, e.g. -#' \code{_PEPTIDEK[Lys6]_}. Any sequence that contains -#' \code{[]} is classified as heavy; all others are light. -#' Sequences that do not have amino acids that can carry the label -#' are classified as \code{NA}. For example, if \code{heavyLabels} is -#' \code{"Lys6"}, then \code{PEPTIDEZ} is classified as NA since it -#' has no lysine residues that could be labeled. +#' \code{_PEPTIDEK[Lys6]_}. Each entry of \code{heavyLabels} names the +#' labelable residue and the label together, as \code{[