From 03ab8eb82e0a3568380294c03f34dbcc88711680 Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Tue, 7 Apr 2026 15:15:47 -0400 Subject: [PATCH 1/2] fix turnover code --- R/converters_SpectronauttoMSstatsFormat.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/converters_SpectronauttoMSstatsFormat.R b/R/converters_SpectronauttoMSstatsFormat.R index 42f14987..b929b0e3 100644 --- a/R/converters_SpectronauttoMSstatsFormat.R +++ b/R/converters_SpectronauttoMSstatsFormat.R @@ -139,14 +139,15 @@ SpectronauttoMSstatsFormat = function( feature_columns = c("PeptideSequence", "PrecursorCharge", "FragmentIon", "ProductCharge") - - fill_isotope_label_type = if (is.null(heavyLabels)) - list("IsotopeLabelType" = "L") else list() + preprocess_feature_columns = if ("IsotopeLabelType" %in% colnames(input)) + c(feature_columns, "IsotopeLabelType") else feature_columns + fill_isotope_label_type = if ("IsotopeLabelType" %in% colnames(input)) + list() else list("IsotopeLabelType" = "L") input = MSstatsConvert::MSstatsPreprocess( input, annotation, - feature_columns, + preprocess_feature_columns, remove_shared_peptides = useUniquePeptide, remove_single_feature_proteins = removeProtein_with1Feature, feature_cleaning = list(remove_features_with_few_measurements = removeFewMeasurements, From bacc483b1fd4e4d6e97db0c8b20ac99d33140269 Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Tue, 7 Apr 2026 15:26:00 -0400 Subject: [PATCH 2/2] add unit tests verifying intensities preserved, number of rows are correct --- .../test_converters_SpectronauttoMSstatsFormat.R | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/inst/tinytest/test_converters_SpectronauttoMSstatsFormat.R b/inst/tinytest/test_converters_SpectronauttoMSstatsFormat.R index 155f47eb..b4a94cec 100644 --- a/inst/tinytest/test_converters_SpectronauttoMSstatsFormat.R +++ b/inst/tinytest/test_converters_SpectronauttoMSstatsFormat.R @@ -427,3 +427,17 @@ output_leu = SpectronauttoMSstatsFormat( use_log_file = FALSE ) expect_false("H" %in% unique(output_leu$IsotopeLabelType)) + +# Verify intensity values for ANGYTTEYSASVK are preserved from FG.MS1Quantity +output_heavy = data.table::as.data.table(output_heavy) +angyt_input_intensities = sort( + boxcar_raw[PEP.StrippedSequence == "ANGYTTEYSASVK", FG.MS1Quantity]) +angyt_output_intensities = sort( + output_heavy[grepl("ANGYTTEYSASVK", PeptideSequence, fixed = TRUE), Intensity]) +expect_equivalent(angyt_input_intensities, angyt_output_intensities) + +# Verify row count for ANGYTTEYSASVK is 2 * number of bioreplicates +# (one row per bioreplicate for heavy label, one for light label) +n_bioreplicates = length(unique(boxcar_raw$R.Replicate)) +angyt_rows = subset(output_heavy, grepl("ANGYTTEYSASVK", PeptideSequence, fixed = TRUE)) +expect_equal(nrow(angyt_rows), 2L * n_bioreplicates)