sneumann / CAMERA

This is the git repository matching the Bioconductor package CAMERA: Collection of annotation related methods for mass spectrometry data
11 stars 21 forks source link

Error in findIsotopesWithValidation function #77

Closed chuyaowang closed 1 year ago

chuyaowang commented 1 year ago

Hello,

I am trying to use CAMERA to detect C13 labeled compounds in my data following the manual on the bioconductor page. I did peak picking with CentWavePredIsoParam, retention time correction, peak grouping, and peak filling with xcms but skipped peak merging because it reduced the number of peaks in one of my data files from ~5000 to ~10. After the preprocessing, I converted the XCMSnExp object to an xcmsSet object and ran it with the following code:

an <- xsAnnotate(data_set, polarity="negative") # constructor; extracts peak table an <- groupFWHM(an, perfwhm = 1) # group peaks by retention time an <- findIsotopesWithValidation(object = an, ppm = 5, mzabs = 0.01, intval="intb", maxcharge = 3) # annotate isotopic peak

The error comes at the 3rd step:

Start grouping after retention time. Created 96 pseudospectra. Generating peak matrix! Run isotope peak annotation % finished: Error in if (!isotopeProportionFits) { : missing value where TRUE/FALSE needed 3. findIsotopesForPS(peakIndeces, mzValues[peakIndeces], intValues[peakIndeces], snValues[peakIndeces], maxcharge = maxcharge, devppm = devppm, mzabs = mzabs, validateIsotopePatterns = validateIsotopePatterns, database = database) 2. findIsotopesWithValidation(object = an, ppm = 5, mzabs = 0.01, intval = "intb", maxcharge = 3) 1. findIsotopesWithValidation(object = an, ppm = 5, mzabs = 0.01, intval = "intb", maxcharge = 3)

It seems that something is missing and causes the isotopeProportionFits variable to be NA, but I can't figure out what it is. Also, if I run findIsotopes instead of findIsotopesWithValidation, it seems isotope clusters can be successfully found, but how to tell from the result peaklist which peaks are isotopologues of each other?

Thank you for your time!

sneumann commented 1 year ago

Hi, thanks for reporting. Upfront, Camera was not designed to group stable isotope labelled peaks.

Could you check if plain findIsotopes() works with your data ?

You'd need to eliminate the filter that checks [M+0] and [M+1] intensity ratios filter=FALSE. Alternatively, one could re-calculate the 12C/13C ratios for labelled samples (which is not trivial with partially labelled samples ...) and pass that via isotopeMatrix.

Yours, Steffen

chuyaowang commented 1 year ago

Thank you for responding so quickly!

Perhaps I am not understanding the proper usage of this package. I have fed some bacteria with 13C labeled glucose, and now I am trying to find which compounds are labeled and the respective mass isotopologue distribution for subsequent metabolic flux analysis. Is this the right tool to use? We only have a set number of compounds to look for, so just filtering mz ratios from the peak table generated by xcms and calculating the mass isotope distribution could be an alternative approach.

findIsotopes runs without error, and I can get a peak table with a column called isotopes like [128][M]-, [128][M+1]-, etc. What do the numbers such as 128 refer to?

The description in the function help is rather succinct, and I am not sure what the isotopeMatrix and filter parameters do, but if I turn the filter off, the function found more isotopes.

sneumann commented 1 year ago

Hi, the [128] is the identifier for the isotope cluster. And no, I don't think CAMERA is the right tool unless you are an experienced R hacker to modify it. You could try some of the tools by the team of Rainer Schumacher https://forschung.boku.ac.at/fis/suchen.person_publikationen?sprache_in=en&ansicht_in=&menue_id_in=102&id_in=5379&publikation_typ_id_in=&sortierung_in=kategorie yours, Steffen

chuyaowang commented 1 year ago

Thank you for the information! I will check out what tools they have.