Repository navigation
Description
SpectronauttoMSstatsFormat, DIANNtoMSstatsFormat and SkylinetoMSstatsFormat turn zero intensities into NA right after MSstatsPreprocess. Four label-free converters never do: MetamorpheusToMSstatsFormat, PDtoMSstatsFormat, MaxQtoMSstatsFormat and OpenMStoMSstatsFormat. The PD, MaxQuant and OpenMS cleaners set zeros to NA only on their TMT paths (.cleanRawPDTMT, and the MSstatsTMT branches of .cleanRawMaxQuant and .cleanRawOpenMS), and the MetaMorpheus cleaner never does. As a result, dataProcess receives zeros from these four converters where it would otherwise receive missing values, and it replaces them with 1 ("There are N intensities which are zero or less than 1. These intensities are replaced with 1"). Intensities in (0, 1] are affected too, because .adjustIntensities in MSstatsPreprocess sets them to 0.
Reproduction
All four reproductions use the tinytest data. They give the same result on 1.22.1 (Bioconductor 3.23, fe449ec) and on 1.23.1, and the zero handling is unchanged on devel. Each one zeros a peak that is alone in its run and gives another peak an intensity below 1. In the MetaMorpheus file, the only zero (SLYASSPGGVYATR in run B03_06) is hidden because the max summarization picks a larger PSM in that run. The other three files have no zeros.
library(data.table)
library(MSstatsConvert)
# MetaMorpheus
d <- system.file("tinytest/raw_data/Metamorpheus", package = "MSstatsConvert")
mm <- fread(file.path(d, "QuantifiedPeaks.tsv"))
mm_annot <- fread(file.path(d, "annotation.csv"))
mm_peak <- function(seq, run) mm$`Full Sequence` == seq & startsWith(mm$`File Name`, run)
mm[mm_peak("SLYASSPGGVYATR", "B03_05"), `Peak intensity` := 0]
mm[mm_peak("SVEELLEAELLK", "B03_05"), `Peak intensity` := 0.5]
out <- MetamorpheusToMSstatsFormat(mm, annotation = mm_annot, use_log_file = FALSE)
sum(out$Intensity == 0, na.rm = TRUE)
#> [1] 2
# Proteome Discoverer, label-free
d <- system.file("tinytest/raw_data/PD", package = "MSstatsConvert")
pd <- fread(file.path(d, "pd_input.csv"))
pd_annot <- fread(file.path(d, "annot_pd.csv"))
pd_peak <- function(seq, z, run) pd$Sequence == seq & pd$Charge == z & grepl(run, pd$Spectrum.File)
pd[pd_peak("ANSHAPEAVVEGASR", 2, "_01_01_"), Precursor.Area := 0]
pd[pd_peak("ANSHAPEAVVEGASR", 2, "_01_04_"), Precursor.Area := 0.5]
out <- PDtoMSstatsFormat(pd, pd_annot, use_log_file = FALSE)
sum(out$Intensity == 0, na.rm = TRUE)
#> [1] 2
# MaxQuant, label-free
d <- system.file("tinytest/raw_data/MaxQuant", package = "MSstatsConvert")
ev <- fread(file.path(d, "mq_ev.csv"))
pg <- fread(file.path(d, "mq_pg.csv"))
mq_annot <- fread(file.path(d, "annotation.csv"))
mq_peak <- function(seq, z, run) ev$Modified.sequence == seq & ev$Charge == z & grepl(run, ev$Raw.file)
ev[mq_peak("_ELMTISK_", 2, "_01_01_"), Intensity := 0]
ev[mq_peak("_ELMTISK_", 2, "_01_02_"), Intensity := 0.5]
out <- MaxQtoMSstatsFormat(ev, mq_annot, pg, use_log_file = FALSE)
sum(out$Intensity == 0, na.rm = TRUE)
#> [1] 2
# OpenMS, label-free. Intensity is read as integer, so make it double first.
om <- fread(system.file("tinytest/raw_data/OpenMS/openms_input.csv", package = "MSstatsConvert"))
om[, Intensity := as.numeric(Intensity)]
om_peak <- function(seq, z, run) om$PeptideSequence == seq & om$PrecursorCharge == z & om$Run == run
om[om_peak("LKPVSFK", 2, 1), Intensity := 0]
om[om_peak("LKPVSFK", 2, 2), Intensity := 0.5]
out <- OpenMStoMSstatsFormat(om, use_log_file = FALSE)
sum(out$Intensity == 0, na.rm = TRUE)
#> [1] 2Expected: 0 for every converter, with each zeroed or below-1 intensity NA.
Impact
On Solivais2024, an E. coli into human spike-in with 20 runs, the MetaMorpheus output has 1,860 zero intensities among 492,020 rows. Setting them to NA before dataProcess(normalization = "equalizeMedians") and groupComparison changes significance for 14 human proteins across the four comparisons, all with adjusted p between 0.04 and 0.06. Eleven drop out of the significant set and three enter it, so false positives fall by 8. We have not measured the impact for the other three converters. The one PD dataset we used (PXD005642) contains no zeros, and we used no MaxQuant or OpenMS data.
Suggested fix
In R/converters_MetamorpheusToMSstatsFormat.R, R/converters_PDtoMSstatsFormat.R, R/converters_MaxQtoMSstatsFormat.R and R/converters_OpenMStoMSstatsFormat.R, add the line SpectronauttoMSstatsFormat uses right after MSstatsPreprocess, so that it also catches the values .adjustIntensities sets to 0:
input[, Intensity := ifelse(Intensity == 0, NA, Intensity)]With that line, every reproduction returns no zeros and the same rows: 20 for MetaMorpheus, 360 for PD, 1,590 for MaxQuant and 372 for OpenMS. In each case only the two affected intensities change, from 0 to NA. Tinytest cases built like the reproductions, with expect_false(any(output$Intensity == 0, na.rm = TRUE)), would cover it. The existing fixture outputs contain no zeros, so the current tests cannot catch this.
Activity