Metabolomics Society Forum

Software => XCMS => R => XCMS - FAQ => Topic started by: AmelieV on July 22, 2019, 10:12:44 AM

Title: XCMS - MS1 scans empty
Post by: AmelieV on July 22, 2019, 10:12:44 AM
Hi,

I'm completely new to MS analysis and to the use of xcms program.
I'm trying to import my LC-MS datas to the xcms program, after conversion of my .d files into mzXML files via MSConvert (ProteoWizard).
An R message tell me that my MS1 scans are empty, I wonder if the problem would be with the conversion settings on MSConvert, does anyone know exactly what settings I should use? Or otherwise what could be the issue leading to some MS1 empty scans?

Thank you!!
Amélie
Title: Re: XCMS - MS1 scans empty
Post by: CoreyG on July 22, 2019, 04:08:33 PM
Hi AmelieV,

You can find some quick notes and screenshots at the following sites: https://ccms-ucsd.github.io/GNPSDocumentation/fileconversion/ (https://ccms-ucsd.github.io/GNPSDocumentation/fileconversion/) and https://xcmsonline.scripps.edu/docs/fileformats.html (https://xcmsonline.scripps.edu/docs/fileformats.html).

There are probably more detailed descriptions/tutorials around, including on this forum. However, I've found that XCMS is fairly robust to most (reasonable) settings in MSconvert.
I'd say the most important thing is to have 'peak picking' as a filter and 'MS levels' with a 1 in the first position (indicating you want MS1 centroided). Both of the links above show this.
The difference in settings between the links shouldn't affect XCMS function (mzXML vs mzML, 32 vs 64 bit, zlib compression).

Hope this can help you get things working.
Title: Re: XCMS - MS1 scans empty
Post by: Jan Stanstrup on July 23, 2019, 01:26:06 AM
You are using a Q-TOF in MS1 mode? For example a QQQ might save the data in a way that won't work in XCMS without using different conversion settings.

You can also open the converted data in MzMine or seeMS (part of ProteoWizard) and see what data is there.
Title: Re: XCMS - MS1 scans empty
Post by: AmelieV on July 23, 2019, 09:37:37 AM
Hi CoreyG,
After a look to your indications and the links you provided, it seems that I was using to good settings on the MSConvert for a classic Q-TOF analysis but maybe not for a QQQ like Jan Stanstrup mentionned.
Thank you for these indications
Title: Re: XCMS - MS1 scans empty
Post by: AmelieV on July 23, 2019, 09:43:03 AM
Hi Jan Stanstrup,

I'm actually not running my samples through a Q-TOF but I'm doing LC-MS with a QQQ. It should explain why I would need a different conversion settings? Do you know more about these settings I should use?
I'm using QQQ in scan mode with parent = 350-600, product = 97. I have a great peak separation and found all the parent ion peaks I was looking for in the MassHunter software.
I opened my converted data in seeMS ans the only scan that appear is a MS level 2, not the MS1 I'm expecting.

Thank you!
Title: Re: XCMS - MS1 scans empty
Post by: Jan Stanstrup on July 23, 2019, 10:08:31 AM
You could try with --simAsSpectra  --srmAsSpectra. Sometimes QQQ data is saved as chromatograms and not spectra.
But I am not understanding what you are doing. You are actually doing a parent ion scan? So then you do have MS2 data. Why expect MS1 data in your setup?
Title: Re: XCMS - MS1 scans empty
Post by: AmelieV on July 24, 2019, 02:16:15 PM
I misspoke what I meant, I am indeed doing a parent ion scan so I do have MS2 data. But when I am importing my data into the xcms program in R, an error message comes up because my "MS1 scans are empty". The xcms program seems to need something in these MS1 scans that I can't provide with my data, or at least with the conversion settings I am using.
I tried with the SIM as Spectra / SRM as Spectra like you suggested but it gives rise to the same error.
Title: Re: XCMS - MS1 scans empty
Post by: Jan Stanstrup on July 25, 2019, 02:53:40 AM
OK. So in your case you actually have MS2 data but want to do peak picking which XCMS is not setup for by default.
@michael.witting has a tutorial on how to do something with MS2 data here: https://github.com/michaelwitting/metabolomics2018/blob/master/XCMS_Witting.pdf

I am not sure how complete the XCMS features are on this but you can find moreon the work here: https://github.com/sneumann/xcms/issues/321
Title: Re: XCMS - MS1 scans empty
Post by: CoreyG on July 25, 2019, 05:15:50 PM
Very cool resources, Jan.

AmelieV, if you only have one product ion per file, it's probably sufficient to "pretend" the MS2 data are MS1 scans.
Pretty sure I have a solution for that somewhere and some precursor ion scan data to test it on. I'll see if I can dig it up.

However, if you have already found the precursor masses, it's probably quickest to setup a Masshunter Quant or Qual method to integrate all the peaks (assuming this is what you are interested in?)
Title: Re: XCMS - MS1 scans empty
Post by: CoreyG on July 26, 2019, 08:46:58 PM
I didn't have any readily available Agilent QqQ precursor ion scan data on hand, but could probably generate some next week if required.

Anyway, this is an old jank solution I was using to "convert" MS2 data to look like MS1 data:
Code: [Select]
## Load mzR library
library(mzR)

## Open the mzML file that you want to convert
dat<-openMSfile('myMSdata.mzML')

## Get spectra data
pks <- spectra(dat)
## Get file header
hdr <- header(dat)

## Remove all scans but ms2 scans
pks<-pks[hdr$msLevel==2]
hdr<-hdr[hdr$msLevel==2,]

## Take a quick look and make sure everything looks ok
head(hdr)

## Provide new scan/acquisition numbers
hdr$seqNum<-hdr$acquisitionNum<-seq(nrow(hdr))

## Clear all precursor charge/Intensity/MZ/ScanNum columns
## Not sure if this is required and how precursor ion scans will differ
hdr$precursorCharge<-hdr$precursorIntensity<-hdr$precursorMZ<-hdr$precursorScanNum<-0

## Overwrite msLevel to 'pretend' to be MS1 data
hdr$msLevel<-1

## Write out the new 'MS1' data
writeMSData(pks,'myAlteredMSdata.mzML',header=hdr)
There are a few fields that still contain MS2 information, so I'm not sure if they will conflict with anything downstream.
So, I'm not sure how well this will work for you. But let everyone know if it's helpful.

Good luck!
Title: Re: XCMS - MS1 scans empty
Post by: AmelieV on July 29, 2019, 05:40:05 PM
Thank you to both of you, that is very helpful!
I'm actually currently digging both of your leads : Jan I have been able to import my datas thanks to a package described in the links you provided! But at some point I'm stuck with one command, I'll have to figure out how to skirt this but I'm sure it's feasible.
CorgeyG your method works thank you!! The program runs well for now, even if some extra warnings comes up, I'll see if it can lead to something without any conflict.

Sorry for my late answer..