Closed jorainer closed 2 years ago
I checked the (php) code of https://doi.org/10.1021/jasms.1c00343 (available here). Seems they are simply calculating precursor m/z - fragment m/z
and report the intensity of the fragment peak. No additional filtering is done. Also, no special handling of negative m/z values etc is performed.
Maybe better to have a parameter filterPeaks = c("none", "largerPmz")
that also supports a user-specified function
to filter the peaks matrix. "largerPmz"
would remove all peaks with an m/z that is larger than the one from the precursor m/z ("Pmz"
).
Maybe you could reuse code from here: https://github.com/lgatto/MSnbase/blob/master/R/functions-fragments.R
(it is already reused/copied to PSMatch
: https://github.com/rformassspectrometry/PSMatch/blob/main/R/fragments-calculate.R)
Seems that type of neutral loss calculations are different than the one I had in mind (i.e. the neutral loss spectra from https://doi.org/10.1021/jasms.1c00343 that are defined as precursor m/z - fragment m/z and the hypothetical neutral loss from https://doi.org/10.1021/acs.analchem.0c02521).
Considering that, it would maybe be better to define neutralLoss
as a method for Spectra
that dispatches on a Param
object which also defines the type of calculation that should be performed:
setMethod("neutralLoss", "Spectra", "NLParam")
to simply calculate precursor m/z - fragment m/zsetMethod("neutralLoss", "Spectra", "HNLParam")
to calculate the hypothetical neutral loss spectrasetMethod("neutralLoss", "Spectra", "FragmentParam")
allowing to define the neutral loss fragment (to accommodate the PSMatch
approach?)The one I had in mind is precursor m/z - fragment m/z
, but if we have the others as well that would be great.
Working on it.
Add a function
neutralLoss
to create neutral loss spectra versions of aSpectra
. The function could be defined in the following way:With
x
being aSpectra
,msLevel.
to define the MS level on which to perform the calculation (MS2 would make most sense obviously) andpeaks
allowing to define in addition if peaks should be pre-filtered:peaks = "all"
: report all fragment peaks.peaks = "bigger"
: only report fragment peaks with an m/z > precursor m/z.peaks = "smaller"
: only report fragment peaks with an m/z < precursor m/z.Any feedback and suggestions welcome @michaelwitting