sneumann / xcms

This is the git repository matching the Bioconductor package xcms: LC/MS and GC/MS Data Analysis
Other
177 stars 81 forks source link

Chromatograms of MS1 data with two different scan events per file #755

Open breidan opened 1 week ago

breidan commented 1 week ago

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