From ddafcbfde81ffc913c5e745cccc07faa9b4c6c89 Mon Sep 17 00:00:00 2001 From: Ashish Magadum Date: Mon, 28 Sep 2026 12:14:50 -0500 Subject: [PATCH 1/7] fix SpectronauttoMSstatsFormat docs --- R/converters_SpectronauttoMSstatsFormat.R | 33 ++++++++++++++++++++++- man/SpectronauttoMSstatsFormat.Rd | 33 ++++++++++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index a45b76eb..6ca4b9be 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -1,6 +1,37 @@ #' Import Spectronaut files #' -#' @param input name of Spectronaut output, which is long-format. ProteinName, PeptideSequence, PrecursorCharge, FragmentIon, ProductCharge, IsotopeLabelType, Condition, BioReplicate, Run, Intensity, F.ExcludedFromQuantification are required. Rows with F.ExcludedFromQuantification=True will be removed. +#' @param input a Spectronaut report in long format, as a data.frame or data.table. +#' Column names are matched with punctuation removed, so \code{FG.Charge}, +#' \code{FG Charge} and \code{FGCharge} are equivalent. Columns are used as follows. +#' \itemize{ +#' \item Required: \code{FG.Charge}; a protein column, either +#' \code{PG.ProteinGroups} or \code{PG.ProteinAccessions}; a peptide column, +#' \code{EG.ModifiedSequence} by default or whichever column +#' \code{peptideSequenceColumn} names; and an intensity column, +#' \code{F.PeakArea} by default or whichever column \code{intensity} names. +#' \item Experiment design: \code{R.FileName}, \code{R.Condition} and +#' \code{R.Replicate}, unless \code{annotation} supplies Run, Condition and +#' BioReplicate instead. \code{R.Fraction} is optional, and recommended for +#' fractionated experiments; when it is absent all runs are treated as a +#' single fraction. +#' \item Optional, synthesized when absent: \code{F.FrgLossType} (treated as +#' "noloss", so no rows are filtered), \code{F.ExcludedFromQuantification} +#' (treated as FALSE), \code{F.FrgIon} and \code{F.Charge} (both NA, since +#' fragment identity is not available in precursor-level reports such as +#' MS1-based protein turnover). \code{PG.Qvalue} and +#' \code{F.PossibleInterference} are used if present. +#' \item Used only when you ask for them: \code{EG.Qvalue}, when +#' \code{filter_with_Qvalue = TRUE}; and the quality metrics named in +#' \code{anomalyModelFeatures}, for which the recommended set is +#' \code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)} and +#' \code{FG.ShapeQualityScore (MS2)}. +#' \item Not read by this function, but worth keeping in the report: +#' \code{R.Run Date (Formatted)}, the timestamp used to build the +#' \code{runOrder} table. +#' } +#' Any other columns in the report are ignored. Rows with +#' \code{F.ExcludedFromQuantification = True} are removed when +#' \code{excludedFromQuantificationFilter = TRUE}, the default. #' @param annotation name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input. #' @param intensity Intensity column to use. Accepts legacy enum values #' \code{'PeakArea'} (default, uses F.PeakArea), \code{'NormalizedPeakArea'} diff --git a/man/SpectronauttoMSstatsFormat.Rd b/man/SpectronauttoMSstatsFormat.Rd index 2233318e..ac96df31 100644 --- a/man/SpectronauttoMSstatsFormat.Rd +++ b/man/SpectronauttoMSstatsFormat.Rd @@ -34,7 +34,38 @@ SpectronauttoMSstatsFormat( ) } \arguments{ -\item{input}{name of Spectronaut output, which is long-format. ProteinName, PeptideSequence, PrecursorCharge, FragmentIon, ProductCharge, IsotopeLabelType, Condition, BioReplicate, Run, Intensity, F.ExcludedFromQuantification are required. Rows with F.ExcludedFromQuantification=True will be removed.} +\item{input}{a Spectronaut report in long format, as a data.frame or data.table. +Column names are matched with punctuation removed, so \code{FG.Charge}, +\code{FG Charge} and \code{FGCharge} are equivalent. Columns are used as follows. +\itemize{ +\item Required: \code{FG.Charge}; a protein column, either +\code{PG.ProteinGroups} or \code{PG.ProteinAccessions}; a peptide column, +\code{EG.ModifiedSequence} by default or whichever column +\code{peptideSequenceColumn} names; and an intensity column, +\code{F.PeakArea} by default or whichever column \code{intensity} names. +\item Experiment design: \code{R.FileName}, \code{R.Condition} and +\code{R.Replicate}, unless \code{annotation} supplies Run, Condition and +BioReplicate instead. \code{R.Fraction} is optional, and recommended for +fractionated experiments; when it is absent all runs are treated as a +single fraction. +\item Optional, synthesized when absent: \code{F.FrgLossType} (treated as +"noloss", so no rows are filtered), \code{F.ExcludedFromQuantification} +(treated as FALSE), \code{F.FrgIon} and \code{F.Charge} (both NA, since +fragment identity is not available in precursor-level reports such as +MS1-based protein turnover). \code{PG.Qvalue} and +\code{F.PossibleInterference} are used if present. +\item Used only when you ask for them: \code{EG.Qvalue}, when +\code{filter_with_Qvalue = TRUE}; and the quality metrics named in +\code{anomalyModelFeatures}, for which the recommended set is +\code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)} and +\code{FG.ShapeQualityScore (MS2)}. +\item Not read by this function, but worth keeping in the report: +\code{R.Run Date (Formatted)}, the timestamp used to build the +\code{runOrder} table. +} +Any other columns in the report are ignored. Rows with +\code{F.ExcludedFromQuantification = True} are removed when +\code{excludedFromQuantificationFilter = TRUE}, the default.} \item{annotation}{name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input.} From ce2e6af137c52930f220dec021f76f4389fc0100 Mon Sep 17 00:00:00 2001 From: Ashish Magadum Date: Mon, 28 Sep 2026 16:31:46 -0500 Subject: [PATCH 2/7] fix docs that explain exluded-quantification filter --- R/converters_SpectronauttoMSstatsFormat.R | 13 +++++++++---- man/SpectronauttoMSstatsFormat.Rd | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index 6ca4b9be..f1d6a4ad 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -29,9 +29,11 @@ #' \code{R.Run Date (Formatted)}, the timestamp used to build the #' \code{runOrder} table. #' } -#' Any other columns in the report are ignored. Rows with -#' \code{F.ExcludedFromQuantification = True} are removed when -#' \code{excludedFromQuantificationFilter = TRUE}, the default. +#' Any other columns in the report are ignored. When +#' \code{excludedFromQuantificationFilter = TRUE}, the default, measurements +#' flagged \code{F.ExcludedFromQuantification = True} have their intensity set +#' to NA rather than their rows being deleted; a feature left with no +#' measurements is then dropped by the usual feature cleaning. #' @param annotation name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input. #' @param intensity Intensity column to use. Accepts legacy enum values #' \code{'PeakArea'} (default, uses F.PeakArea), \code{'NormalizedPeakArea'} @@ -60,7 +62,10 @@ #' reported. #' #' Defaults to \code{NULL}: turnover mode off, every peptide marked light. -#' @param excludedFromQuantificationFilter Remove rows with F.ExcludedFromQuantification=TRUE Default is TRUE. +#' @param excludedFromQuantificationFilter TRUE (default) sets the intensity of +#' measurements flagged \code{F.ExcludedFromQuantification = TRUE} to NA, keeping +#' the rows; a feature left with no measurements is then dropped by feature +#' cleaning. FALSE keeps the reported intensities. #' @param filter_with_Qvalue FALSE(default) will not perform any filtering. TRUE will filter out the intensities that have greater than qvalue_cutoff in EG.Qvalue column. Those intensities will be replaced with zero and will be considered as censored missing values for imputation purpose. #' @param qvalue_cutoff Cutoff for EG.Qvalue. default is 0.01. #' @param calculateAnomalyScores Default is FALSE. If TRUE, will run anomaly detection model and calculate anomaly scores for each feature. Used downstream to weigh measurements in differential analysis. diff --git a/man/SpectronauttoMSstatsFormat.Rd b/man/SpectronauttoMSstatsFormat.Rd index ac96df31..5056869c 100644 --- a/man/SpectronauttoMSstatsFormat.Rd +++ b/man/SpectronauttoMSstatsFormat.Rd @@ -63,9 +63,11 @@ MS1-based protein turnover). \code{PG.Qvalue} and \code{R.Run Date (Formatted)}, the timestamp used to build the \code{runOrder} table. } -Any other columns in the report are ignored. Rows with -\code{F.ExcludedFromQuantification = True} are removed when -\code{excludedFromQuantificationFilter = TRUE}, the default.} +Any other columns in the report are ignored. When +\code{excludedFromQuantificationFilter = TRUE}, the default, measurements +flagged \code{F.ExcludedFromQuantification = True} have their intensity set +to NA rather than their rows being deleted; a feature left with no +measurements is then dropped by the usual feature cleaning.} \item{annotation}{name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input.} @@ -99,7 +101,10 @@ reported. Defaults to \code{NULL}: turnover mode off, every peptide marked light.} -\item{excludedFromQuantificationFilter}{Remove rows with F.ExcludedFromQuantification=TRUE Default is TRUE.} +\item{excludedFromQuantificationFilter}{TRUE (default) sets the intensity of +measurements flagged \code{F.ExcludedFromQuantification = TRUE} to NA, keeping +the rows; a feature left with no measurements is then dropped by feature +cleaning. FALSE keeps the reported intensities.} \item{filter_with_Qvalue}{FALSE(default) will not perform any filtering. TRUE will filter out the intensities that have greater than qvalue_cutoff in EG.Qvalue column. Those intensities will be replaced with zero and will be considered as censored missing values for imputation purpose.} From 4da1cbf38a00fb88e0c64de575acda4312a925b4 Mon Sep 17 00:00:00 2001 From: Ashish Magadum Date: Mon, 28 Sep 2026 18:00:27 -0500 Subject: [PATCH 3/7] coderabbit's suggested fix: fractionated exp --- R/converters_SpectronauttoMSstatsFormat.R | 27 ++++++++++++++--------- man/SpectronauttoMSstatsFormat.Rd | 27 ++++++++++++++--------- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index f1d6a4ad..8d204249 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -9,20 +9,27 @@ #' \code{EG.ModifiedSequence} by default or whichever column #' \code{peptideSequenceColumn} names; and an intensity column, #' \code{F.PeakArea} by default or whichever column \code{intensity} names. -#' \item Experiment design: \code{R.FileName}, \code{R.Condition} and -#' \code{R.Replicate}, unless \code{annotation} supplies Run, Condition and -#' BioReplicate instead. \code{R.Fraction} is optional, and recommended for -#' fractionated experiments; when it is absent all runs are treated as a -#' single fraction. +#' \item Experiment design: \code{R.FileName} is required as the input run +#' key. When supplied, an annotation with matching \code{Run}, \code{Condition} +#' and \code{BioReplicate} may replace \code{R.Condition} and +#' \code{R.Replicate}, but it cannot replace \code{R.FileName}. +#' \code{R.Fraction} is optional, and recommended for fractionated experiments. +#' When it is absent, fractionation is detected from repeated runs within a +#' condition and biological replicate. Fraction 1 is assigned only when no +#' fractionation is detected, and some layouts can be rejected as risky. #' \item Optional, synthesized when absent: \code{F.FrgLossType} (treated as #' "noloss", so no rows are filtered), \code{F.ExcludedFromQuantification} #' (treated as FALSE), \code{F.FrgIon} and \code{F.Charge} (both NA, since #' fragment identity is not available in precursor-level reports such as -#' MS1-based protein turnover). \code{PG.Qvalue} and -#' \code{F.PossibleInterference} are used if present. -#' \item Used only when you ask for them: \code{EG.Qvalue}, when -#' \code{filter_with_Qvalue = TRUE}; and the quality metrics named in -#' \code{anomalyModelFeatures}, for which the recommended set is +#' MS1-based protein turnover). +#' \code{F.PossibleInterference} is used if present. +#' \item Used only when you ask for them: \code{EG.Qvalue} and +#' \code{PG.Qvalue}, when \code{filter_with_Qvalue = TRUE}, if present. +#' \code{EG.Qvalue} is compared against \code{qvalue_cutoff} and +#' \code{PG.Qvalue} against a fixed cutoff of 0.01. +#' A measurement that fails either q-value cutoff has its intensity set to +#' NA; q-value filtering does not delete the row. The quality metrics named +#' in \code{anomalyModelFeatures} are read here too; the recommended set is #' \code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)} and #' \code{FG.ShapeQualityScore (MS2)}. #' \item Not read by this function, but worth keeping in the report: diff --git a/man/SpectronauttoMSstatsFormat.Rd b/man/SpectronauttoMSstatsFormat.Rd index 5056869c..82420f74 100644 --- a/man/SpectronauttoMSstatsFormat.Rd +++ b/man/SpectronauttoMSstatsFormat.Rd @@ -43,20 +43,27 @@ Column names are matched with punctuation removed, so \code{FG.Charge}, \code{EG.ModifiedSequence} by default or whichever column \code{peptideSequenceColumn} names; and an intensity column, \code{F.PeakArea} by default or whichever column \code{intensity} names. -\item Experiment design: \code{R.FileName}, \code{R.Condition} and -\code{R.Replicate}, unless \code{annotation} supplies Run, Condition and -BioReplicate instead. \code{R.Fraction} is optional, and recommended for -fractionated experiments; when it is absent all runs are treated as a -single fraction. +\item Experiment design: \code{R.FileName} is required as the input run +key. When supplied, an annotation with matching \code{Run}, \code{Condition} +and \code{BioReplicate} may replace \code{R.Condition} and +\code{R.Replicate}, but it cannot replace \code{R.FileName}. +\code{R.Fraction} is optional, and recommended for fractionated experiments. +When it is absent, fractionation is detected from repeated runs within a +condition and biological replicate. Fraction 1 is assigned only when no +fractionation is detected, and some layouts can be rejected as risky. \item Optional, synthesized when absent: \code{F.FrgLossType} (treated as "noloss", so no rows are filtered), \code{F.ExcludedFromQuantification} (treated as FALSE), \code{F.FrgIon} and \code{F.Charge} (both NA, since fragment identity is not available in precursor-level reports such as -MS1-based protein turnover). \code{PG.Qvalue} and -\code{F.PossibleInterference} are used if present. -\item Used only when you ask for them: \code{EG.Qvalue}, when -\code{filter_with_Qvalue = TRUE}; and the quality metrics named in -\code{anomalyModelFeatures}, for which the recommended set is +MS1-based protein turnover). +\code{F.PossibleInterference} is used if present. +\item Used only when you ask for them: \code{EG.Qvalue} and +\code{PG.Qvalue}, when \code{filter_with_Qvalue = TRUE}, if present. +\code{EG.Qvalue} is compared against \code{qvalue_cutoff} and +\code{PG.Qvalue} against a fixed cutoff of 0.01. +A measurement that fails either q-value cutoff has its intensity set to +NA; q-value filtering does not delete the row. The quality metrics named +in \code{anomalyModelFeatures} are read here too; the recommended set is \code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)} and \code{FG.ShapeQualityScore (MS2)}. \item Not read by this function, but worth keeping in the report: From 767ab6f762a8681831722935619efad8ff3662c8 Mon Sep 17 00:00:00 2001 From: Ashish Magadum Date: Mon, 28 Sep 2026 18:22:43 -0500 Subject: [PATCH 4/7] fix filter_with_Qvalue FALSE(default) clause --- R/converters_SpectronauttoMSstatsFormat.R | 5 ++++- man/SpectronauttoMSstatsFormat.Rd | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index 8d204249..65d5c580 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -73,7 +73,10 @@ #' measurements flagged \code{F.ExcludedFromQuantification = TRUE} to NA, keeping #' the rows; a feature left with no measurements is then dropped by feature #' cleaning. FALSE keeps the reported intensities. -#' @param filter_with_Qvalue FALSE(default) will not perform any filtering. TRUE will filter out the intensities that have greater than qvalue_cutoff in EG.Qvalue column. Those intensities will be replaced with zero and will be considered as censored missing values for imputation purpose. +#' @param filter_with_Qvalue FALSE (default) does not perform any filtering. +#' TRUE sets the intensity to NA for measurements that exceed qvalue_cutoff +#' in EG.Qvalue or 0.01 in PG.Qvalue. The rows are retained, and the NA +#' values are treated as censored missing values for imputation. #' @param qvalue_cutoff Cutoff for EG.Qvalue. default is 0.01. #' @param calculateAnomalyScores Default is FALSE. If TRUE, will run anomaly detection model and calculate anomaly scores for each feature. Used downstream to weigh measurements in differential analysis. #' @param anomalyModelFeatures character vector of quality metric column names to be used as features in the anomaly detection model. List must not be empty if calculateAnomalyScores=TRUE. diff --git a/man/SpectronauttoMSstatsFormat.Rd b/man/SpectronauttoMSstatsFormat.Rd index 82420f74..759952c8 100644 --- a/man/SpectronauttoMSstatsFormat.Rd +++ b/man/SpectronauttoMSstatsFormat.Rd @@ -113,7 +113,10 @@ measurements flagged \code{F.ExcludedFromQuantification = TRUE} to NA, keeping the rows; a feature left with no measurements is then dropped by feature cleaning. FALSE keeps the reported intensities.} -\item{filter_with_Qvalue}{FALSE(default) will not perform any filtering. TRUE will filter out the intensities that have greater than qvalue_cutoff in EG.Qvalue column. Those intensities will be replaced with zero and will be considered as censored missing values for imputation purpose.} +\item{filter_with_Qvalue}{FALSE (default) does not perform any filtering. +TRUE sets the intensity to NA for measurements that exceed qvalue_cutoff +in EG.Qvalue or 0.01 in PG.Qvalue. The rows are retained, and the NA +values are treated as censored missing values for imputation.} \item{qvalue_cutoff}{Cutoff for EG.Qvalue. default is 0.01.} From 9d24b35b3d84843cffecdcbe2d8880a1adf026f7 Mon Sep 17 00:00:00 2001 From: Ashish Magadum Date: Thu, 1 Oct 2026 16:20:01 -0500 Subject: [PATCH 5/7] make docs less granular --- R/converters_SpectronauttoMSstatsFormat.R | 95 ++++++++++++----------- man/SpectronauttoMSstatsFormat.Rd | 95 ++++++++++++----------- 2 files changed, 102 insertions(+), 88 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index 65d5c580..86c52f6b 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -1,46 +1,53 @@ #' Import Spectronaut files #' -#' @param input a Spectronaut report in long format, as a data.frame or data.table. -#' Column names are matched with punctuation removed, so \code{FG.Charge}, -#' \code{FG Charge} and \code{FGCharge} are equivalent. Columns are used as follows. -#' \itemize{ -#' \item Required: \code{FG.Charge}; a protein column, either -#' \code{PG.ProteinGroups} or \code{PG.ProteinAccessions}; a peptide column, -#' \code{EG.ModifiedSequence} by default or whichever column -#' \code{peptideSequenceColumn} names; and an intensity column, -#' \code{F.PeakArea} by default or whichever column \code{intensity} names. -#' \item Experiment design: \code{R.FileName} is required as the input run -#' key. When supplied, an annotation with matching \code{Run}, \code{Condition} -#' and \code{BioReplicate} may replace \code{R.Condition} and -#' \code{R.Replicate}, but it cannot replace \code{R.FileName}. -#' \code{R.Fraction} is optional, and recommended for fractionated experiments. -#' When it is absent, fractionation is detected from repeated runs within a -#' condition and biological replicate. Fraction 1 is assigned only when no -#' fractionation is detected, and some layouts can be rejected as risky. -#' \item Optional, synthesized when absent: \code{F.FrgLossType} (treated as -#' "noloss", so no rows are filtered), \code{F.ExcludedFromQuantification} -#' (treated as FALSE), \code{F.FrgIon} and \code{F.Charge} (both NA, since -#' fragment identity is not available in precursor-level reports such as -#' MS1-based protein turnover). -#' \code{F.PossibleInterference} is used if present. -#' \item Used only when you ask for them: \code{EG.Qvalue} and -#' \code{PG.Qvalue}, when \code{filter_with_Qvalue = TRUE}, if present. -#' \code{EG.Qvalue} is compared against \code{qvalue_cutoff} and -#' \code{PG.Qvalue} against a fixed cutoff of 0.01. -#' A measurement that fails either q-value cutoff has its intensity set to -#' NA; q-value filtering does not delete the row. The quality metrics named -#' in \code{anomalyModelFeatures} are read here too; the recommended set is -#' \code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)} and -#' \code{FG.ShapeQualityScore (MS2)}. -#' \item Not read by this function, but worth keeping in the report: -#' \code{R.Run Date (Formatted)}, the timestamp used to build the -#' \code{runOrder} table. +#' @param input a Spectronaut report in long format, as a data.frame or +#' data.table. Dots and spaces in column names are ignored, so +#' \code{FG.Charge}, \code{FG Charge} and \code{FGCharge} are equivalent. +#' \describe{ +#' \item{\code{PG.ProteinGroups} or \code{PG.ProteinAccessions}}{The protein +#' identifier. Required.} +#' \item{\code{EG.ModifiedSequence} or \code{FG.LabeledSequence}}{The peptide +#' sequence including modifications. Required; \code{peptideSequenceColumn} +#' selects which one is read and defaults to \code{EG.ModifiedSequence}. +#' \code{FG.LabeledSequence} carries the heavy-label tags used by protein +#' turnover experiments.} +#' \item{\code{FG.Charge}}{Charge state of the precursor. Required.} +#' \item{\code{F.PeakArea}}{The measured intensity. Required; +#' \code{intensity} selects which column is read.} +#' \item{\code{R.FileName}}{Identifies the MS run. Required, and cannot be +#' supplied through \code{annotation}.} +#' \item{\code{R.Condition}, \code{R.Replicate}}{The condition and biological +#' replicate of each run. May be supplied through \code{annotation} +#' instead, matched on \code{Run}.} +#' \item{\code{R.Fraction}}{Which fraction of a fractionated sample the run +#' came from. Required for fractionated experiments.} +#' \item{\code{F.FrgIon}, \code{F.Charge}}{The fragment ion and its charge +#' state. Needed for differential abundance analysis at the MS2 level. +#' Precursor-level reports, such as those used for protein turnover, do not +#' contain them, and the analysis then proceeds at the precursor level.} +#' \item{\code{F.FrgLossType}}{The neutral loss carried by the fragment ion; +#' fragment ions that have not undergone a neutral loss are set to +#' \code{"noloss"}. When present, only \code{"noloss"} fragments are kept. +#' When absent, no filtering on loss type is done.} +#' \item{\code{F.ExcludedFromQuantification}}{Rows that should be excluded +#' from quantification are set to TRUE. When present and +#' \code{excludedFromQuantificationFilter = TRUE}, those measurements are +#' excluded: the intensity is set to NA, and a row is removed if it +#' corresponds to a feature with no measurements across all MS runs. When +#' absent, nothing is excluded on this basis.} +#' \item{\code{EG.Qvalue}, \code{PG.Qvalue}}{Identification confidence for the +#' precursor and for the protein group. Used when +#' \code{filter_with_Qvalue = TRUE}; measurements failing the cutoffs are +#' excluded. When absent, no q-value filtering is done.} +#' \item{\code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)}, +#' \code{FG.ShapeQualityScore (MS2)}}{Quality metrics. The recommended set +#' to pass to \code{anomalyModelFeatures} when +#' \code{calculateAnomalyScores = TRUE}.} +#' \item{\code{R.Run Date (Formatted)}}{When each run was acquired. Not read +#' by this function, but it is what the \code{runOrder} table is built +#' from.} #' } -#' Any other columns in the report are ignored. When -#' \code{excludedFromQuantificationFilter = TRUE}, the default, measurements -#' flagged \code{F.ExcludedFromQuantification = True} have their intensity set -#' to NA rather than their rows being deleted; a feature left with no -#' measurements is then dropped by the usual feature cleaning. +#' Any other columns in the report are ignored. #' @param annotation name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input. #' @param intensity Intensity column to use. Accepts legacy enum values #' \code{'PeakArea'} (default, uses F.PeakArea), \code{'NormalizedPeakArea'} @@ -69,10 +76,10 @@ #' reported. #' #' Defaults to \code{NULL}: turnover mode off, every peptide marked light. -#' @param excludedFromQuantificationFilter TRUE (default) sets the intensity of -#' measurements flagged \code{F.ExcludedFromQuantification = TRUE} to NA, keeping -#' the rows; a feature left with no measurements is then dropped by feature -#' cleaning. FALSE keeps the reported intensities. +#' @param excludedFromQuantificationFilter TRUE (default) excludes measurements +#' flagged \code{F.ExcludedFromQuantification = TRUE}: the intensity is set to +#' NA, and a row is removed if it corresponds to a feature with no measurements +#' across all MS runs. FALSE keeps the reported intensities. #' @param filter_with_Qvalue FALSE (default) does not perform any filtering. #' TRUE sets the intensity to NA for measurements that exceed qvalue_cutoff #' in EG.Qvalue or 0.01 in PG.Qvalue. The rows are retained, and the NA diff --git a/man/SpectronauttoMSstatsFormat.Rd b/man/SpectronauttoMSstatsFormat.Rd index 759952c8..d05866e9 100644 --- a/man/SpectronauttoMSstatsFormat.Rd +++ b/man/SpectronauttoMSstatsFormat.Rd @@ -34,47 +34,54 @@ SpectronauttoMSstatsFormat( ) } \arguments{ -\item{input}{a Spectronaut report in long format, as a data.frame or data.table. -Column names are matched with punctuation removed, so \code{FG.Charge}, -\code{FG Charge} and \code{FGCharge} are equivalent. Columns are used as follows. -\itemize{ -\item Required: \code{FG.Charge}; a protein column, either -\code{PG.ProteinGroups} or \code{PG.ProteinAccessions}; a peptide column, -\code{EG.ModifiedSequence} by default or whichever column -\code{peptideSequenceColumn} names; and an intensity column, -\code{F.PeakArea} by default or whichever column \code{intensity} names. -\item Experiment design: \code{R.FileName} is required as the input run -key. When supplied, an annotation with matching \code{Run}, \code{Condition} -and \code{BioReplicate} may replace \code{R.Condition} and -\code{R.Replicate}, but it cannot replace \code{R.FileName}. -\code{R.Fraction} is optional, and recommended for fractionated experiments. -When it is absent, fractionation is detected from repeated runs within a -condition and biological replicate. Fraction 1 is assigned only when no -fractionation is detected, and some layouts can be rejected as risky. -\item Optional, synthesized when absent: \code{F.FrgLossType} (treated as -"noloss", so no rows are filtered), \code{F.ExcludedFromQuantification} -(treated as FALSE), \code{F.FrgIon} and \code{F.Charge} (both NA, since -fragment identity is not available in precursor-level reports such as -MS1-based protein turnover). -\code{F.PossibleInterference} is used if present. -\item Used only when you ask for them: \code{EG.Qvalue} and -\code{PG.Qvalue}, when \code{filter_with_Qvalue = TRUE}, if present. -\code{EG.Qvalue} is compared against \code{qvalue_cutoff} and -\code{PG.Qvalue} against a fixed cutoff of 0.01. -A measurement that fails either q-value cutoff has its intensity set to -NA; q-value filtering does not delete the row. The quality metrics named -in \code{anomalyModelFeatures} are read here too; the recommended set is -\code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)} and -\code{FG.ShapeQualityScore (MS2)}. -\item Not read by this function, but worth keeping in the report: -\code{R.Run Date (Formatted)}, the timestamp used to build the -\code{runOrder} table. +\item{input}{a Spectronaut report in long format, as a data.frame or +data.table. Dots and spaces in column names are ignored, so +\code{FG.Charge}, \code{FG Charge} and \code{FGCharge} are equivalent. +\describe{ +\item{\code{PG.ProteinGroups} or \code{PG.ProteinAccessions}}{The protein +identifier. Required.} +\item{\code{EG.ModifiedSequence} or \code{FG.LabeledSequence}}{The peptide +sequence including modifications. Required; \code{peptideSequenceColumn} +selects which one is read and defaults to \code{EG.ModifiedSequence}. +\code{FG.LabeledSequence} carries the heavy-label tags used by protein +turnover experiments.} +\item{\code{FG.Charge}}{Charge state of the precursor. Required.} +\item{\code{F.PeakArea}}{The measured intensity. Required; +\code{intensity} selects which column is read.} +\item{\code{R.FileName}}{Identifies the MS run. Required, and cannot be +supplied through \code{annotation}.} +\item{\code{R.Condition}, \code{R.Replicate}}{The condition and biological +replicate of each run. May be supplied through \code{annotation} +instead, matched on \code{Run}.} +\item{\code{R.Fraction}}{Which fraction of a fractionated sample the run +came from. Required for fractionated experiments.} +\item{\code{F.FrgIon}, \code{F.Charge}}{The fragment ion and its charge +state. Needed for differential abundance analysis at the MS2 level. +Precursor-level reports, such as those used for protein turnover, do not +contain them, and the analysis then proceeds at the precursor level.} +\item{\code{F.FrgLossType}}{The neutral loss carried by the fragment ion; +fragment ions that have not undergone a neutral loss are set to +\code{"noloss"}. When present, only \code{"noloss"} fragments are kept. +When absent, no filtering on loss type is done.} +\item{\code{F.ExcludedFromQuantification}}{Rows that should be excluded +from quantification are set to TRUE. When present and +\code{excludedFromQuantificationFilter = TRUE}, those measurements are +excluded: the intensity is set to NA, and a row is removed if it +corresponds to a feature with no measurements across all MS runs. When +absent, nothing is excluded on this basis.} +\item{\code{EG.Qvalue}, \code{PG.Qvalue}}{Identification confidence for the +precursor and for the protein group. Used when +\code{filter_with_Qvalue = TRUE}; measurements failing the cutoffs are +excluded. When absent, no q-value filtering is done.} +\item{\code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)}, +\code{FG.ShapeQualityScore (MS2)}}{Quality metrics. The recommended set +to pass to \code{anomalyModelFeatures} when +\code{calculateAnomalyScores = TRUE}.} +\item{\code{R.Run Date (Formatted)}}{When each run was acquired. Not read +by this function, but it is what the \code{runOrder} table is built +from.} } -Any other columns in the report are ignored. When -\code{excludedFromQuantificationFilter = TRUE}, the default, measurements -flagged \code{F.ExcludedFromQuantification = True} have their intensity set -to NA rather than their rows being deleted; a feature left with no -measurements is then dropped by the usual feature cleaning.} +Any other columns in the report are ignored.} \item{annotation}{name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input.} @@ -108,10 +115,10 @@ reported. Defaults to \code{NULL}: turnover mode off, every peptide marked light.} -\item{excludedFromQuantificationFilter}{TRUE (default) sets the intensity of -measurements flagged \code{F.ExcludedFromQuantification = TRUE} to NA, keeping -the rows; a feature left with no measurements is then dropped by feature -cleaning. FALSE keeps the reported intensities.} +\item{excludedFromQuantificationFilter}{TRUE (default) excludes measurements +flagged \code{F.ExcludedFromQuantification = TRUE}: the intensity is set to +NA, and a row is removed if it corresponds to a feature with no measurements +across all MS runs. FALSE keeps the reported intensities.} \item{filter_with_Qvalue}{FALSE (default) does not perform any filtering. TRUE sets the intensity to NA for measurements that exceed qvalue_cutoff From 9a743d8cfb93cba7c940d9ee53fd5da86fba785c Mon Sep 17 00:00:00 2001 From: Ashish Magadum Date: Fri, 2 Oct 2026 11:15:10 -0500 Subject: [PATCH 6/7] update filter_with_Qvalue and Run date params --- R/converters_SpectronauttoMSstatsFormat.R | 9 ++++----- man/SpectronauttoMSstatsFormat.Rd | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index 86c52f6b..20e430ac 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -37,15 +37,14 @@ #' absent, nothing is excluded on this basis.} #' \item{\code{EG.Qvalue}, \code{PG.Qvalue}}{Identification confidence for the #' precursor and for the protein group. Used when -#' \code{filter_with_Qvalue = TRUE}; measurements failing the cutoffs are -#' excluded. When absent, no q-value filtering is done.} +#' \code{filter_with_Qvalue = TRUE}; \code{qvalue_cutoff} applies to +#' \code{EG.Qvalue} only. Measurements failing either cutoff are excluded. +#' When absent, no q-value filtering is done.} #' \item{\code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)}, #' \code{FG.ShapeQualityScore (MS2)}}{Quality metrics. The recommended set #' to pass to \code{anomalyModelFeatures} when #' \code{calculateAnomalyScores = TRUE}.} -#' \item{\code{R.Run Date (Formatted)}}{When each run was acquired. Not read -#' by this function, but it is what the \code{runOrder} table is built -#' from.} +#' \item{\code{R.Run Date (Formatted)}}{Date when each run was acquired.} #' } #' Any other columns in the report are ignored. #' @param annotation name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input. diff --git a/man/SpectronauttoMSstatsFormat.Rd b/man/SpectronauttoMSstatsFormat.Rd index d05866e9..d488956f 100644 --- a/man/SpectronauttoMSstatsFormat.Rd +++ b/man/SpectronauttoMSstatsFormat.Rd @@ -71,15 +71,14 @@ corresponds to a feature with no measurements across all MS runs. When absent, nothing is excluded on this basis.} \item{\code{EG.Qvalue}, \code{PG.Qvalue}}{Identification confidence for the precursor and for the protein group. Used when -\code{filter_with_Qvalue = TRUE}; measurements failing the cutoffs are -excluded. When absent, no q-value filtering is done.} +\code{filter_with_Qvalue = TRUE}; \code{qvalue_cutoff} applies to +\code{EG.Qvalue} only. Measurements failing either cutoff are excluded. +When absent, no q-value filtering is done.} \item{\code{EG.DeltaRT}, \code{FG.ShapeQualityScore (MS1)}, \code{FG.ShapeQualityScore (MS2)}}{Quality metrics. The recommended set to pass to \code{anomalyModelFeatures} when \code{calculateAnomalyScores = TRUE}.} -\item{\code{R.Run Date (Formatted)}}{When each run was acquired. Not read -by this function, but it is what the \code{runOrder} table is built -from.} +\item{\code{R.Run Date (Formatted)}}{Date when each run was acquired.} } Any other columns in the report are ignored.} From 73d88e37a5c16fc9bfc9de2571b344000e1e670d Mon Sep 17 00:00:00 2001 From: Ashish Magadum Date: Fri, 2 Oct 2026 11:27:59 -0500 Subject: [PATCH 7/7] update R.FileName, R.Run Date --- R/converters_SpectronauttoMSstatsFormat.R | 10 ++++++---- man/SpectronauttoMSstatsFormat.Rd | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index 20e430ac..a2edc095 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -14,11 +14,10 @@ #' \item{\code{FG.Charge}}{Charge state of the precursor. Required.} #' \item{\code{F.PeakArea}}{The measured intensity. Required; #' \code{intensity} selects which column is read.} -#' \item{\code{R.FileName}}{Identifies the MS run. Required, and cannot be -#' supplied through \code{annotation}.} +#' \item{\code{R.FileName}}{Identifies the MS run. Required.} #' \item{\code{R.Condition}, \code{R.Replicate}}{The condition and biological #' replicate of each run. May be supplied through \code{annotation} -#' instead, matched on \code{Run}.} +#' instead, whose \code{Run} column holds the \code{R.FileName} values.} #' \item{\code{R.Fraction}}{Which fraction of a fractionated sample the run #' came from. Required for fractionated experiments.} #' \item{\code{F.FrgIon}, \code{F.Charge}}{The fragment ion and its charge @@ -44,7 +43,10 @@ #' \code{FG.ShapeQualityScore (MS2)}}{Quality metrics. The recommended set #' to pass to \code{anomalyModelFeatures} when #' \code{calculateAnomalyScores = TRUE}.} -#' \item{\code{R.Run Date (Formatted)}}{Date when each run was acquired.} +#' \item{\code{R.Run Date (Formatted)}}{Date when each run was acquired. Used +#' to build the \code{runOrder} table passed to this function, which the +#' temporal features in \code{anomalyModelFeatureTemporal} need when +#' \code{calculateAnomalyScores = TRUE}.} #' } #' Any other columns in the report are ignored. #' @param annotation name of 'annotation.txt' data which includes Condition, BioReplicate, Run. If annotation is already complete in Spectronaut, use annotation=NULL (default). It will use the annotation information from input. diff --git a/man/SpectronauttoMSstatsFormat.Rd b/man/SpectronauttoMSstatsFormat.Rd index d488956f..102a3cd1 100644 --- a/man/SpectronauttoMSstatsFormat.Rd +++ b/man/SpectronauttoMSstatsFormat.Rd @@ -48,11 +48,10 @@ turnover experiments.} \item{\code{FG.Charge}}{Charge state of the precursor. Required.} \item{\code{F.PeakArea}}{The measured intensity. Required; \code{intensity} selects which column is read.} -\item{\code{R.FileName}}{Identifies the MS run. Required, and cannot be -supplied through \code{annotation}.} +\item{\code{R.FileName}}{Identifies the MS run. Required.} \item{\code{R.Condition}, \code{R.Replicate}}{The condition and biological replicate of each run. May be supplied through \code{annotation} -instead, matched on \code{Run}.} +instead, whose \code{Run} column holds the \code{R.FileName} values.} \item{\code{R.Fraction}}{Which fraction of a fractionated sample the run came from. Required for fractionated experiments.} \item{\code{F.FrgIon}, \code{F.Charge}}{The fragment ion and its charge @@ -78,7 +77,10 @@ When absent, no q-value filtering is done.} \code{FG.ShapeQualityScore (MS2)}}{Quality metrics. The recommended set to pass to \code{anomalyModelFeatures} when \code{calculateAnomalyScores = TRUE}.} -\item{\code{R.Run Date (Formatted)}}{Date when each run was acquired.} +\item{\code{R.Run Date (Formatted)}}{Date when each run was acquired. Used +to build the \code{runOrder} table passed to this function, which the +temporal features in \code{anomalyModelFeatureTemporal} need when +\code{calculateAnomalyScores = TRUE}.} } Any other columns in the report are ignored.}