sneumann/xcms

Chromatograms of MS1 data with two different scan events per file

Closed this issue · 6 comments

Hi,
this is a follow on of issue #723. @jorainer suggested to assign msLevel 1 to the first scan event, and 2 to the second. That way one MsExperiment object can be processed with findChromPeaks(object,msLevel=1L,...) and findChromPeaks(object,msLevel=2L,...) to obtain all chromPeaks in one object. That works fine. What is not working is extracting chromatograms with chromatogram(object,msLevel=2L).

Data from an Orbitrap Elite were converted with msconvert to mzML and read in and then split by the two scan events (they occur in the order below):

msexp <- readMsExperiment(spectraFiles = files[timeord], backend = MsBackendMzR(),sampleData = pd[timeord,])
mse1 <- filterSpectra(msexp, filter = filterFilterString, value = "FTMS + c ESI sid=10.00 SIM ms [300.00-800.00]")
mse2 <- filterSpectra(msexp, filter = filterFilterString, value = "FTMS + c ESI sid=10.00 SIM ms [600.00-1200.00]")

From here I obtained the expected chromatograms with

chromatogram(mse1,mz=c(394.75,394.77))|>plot()
chromatogram(mse2,mz=c(663.70,663.72))|>plot()

If I change the msLevel in msexp for the second scan event to 2 with

mslevel<-spectra(msexp)$msLevel
scanType<-spectra(msexp)$filterString
mslevel[grep("600.00",scanType)]<-2L
spectra(msexp)$msLevel<-mslevel

then chromatogram(msexp,mz=(394.75,394.77))|>plot() produces a chromatogram while chromatogram(msexp,mz=c(663.70,663.72),msLevel=2L)|>plot() comes up empty. In chromPeaks all possible peaks in the range from m/z 300 to 1200 are listed. Any ideas how I can draw the chromatograms for the second scan event? Or how to better deal with multiple scan events per file?

The versions of the relevant packages:

[1] Spectra_1.14.0 S4Vectors_0.42.0 BiocGenerics_0.50.0
[5] MsExperiment_1.6.0 ProtGenerics_1.36.0 xcms_4.2.1

This is strange. Can you maybe share one example file (with both MS1 and MS2 in it) for me to test? in case my email is johannes.rainer at eurac.edu

@jorainer,
the attached zip conatins two mzML files with two scan events per file. They do not contain real MS2 data. The filterFilterString function from above is defined as:

filterFilterString <- function(x, value) {
x[x$filterString == value]
}

So executing the commands from my post above should result in an Empty MChromatograms output for chromatogram(msexp,mz=c(663.70,663.72),msLevel=2L)|>plot()

mzMLs.zip

Thanks for sharing the data. Indeed, this is a bug. I am currently working on a fix.

@breidan , the bug is fixed - until it is merged into the devel respectively release branch you could install it from the respective github branch (if you use Bioconductor 3.19 release using BiocManager::install("sneumann/xcms", ref = "RELEASE_3_19_issue_755")). I checked it also with your example and chromatogram() should now work as expected.

@jorainer,

thanks for the help. It is now working as expected.

good to hear and thanks for the feedback!