Open cbielow opened 8 years ago
Hi Chris, the problem is not maxElements but that you need to initialize the allowed elements up front if different from CHNOPS. Try this: m = getMolecule("Na") decomposeMass(m$exactmass, elements=initializeElements(c("C","Na"))) Don't try it without the "C" though. :) Bests [jan]
Thanks Jan, that's indeed the correct solution. If either one of you could add a PR to add that to the manpage, that would be great. Yours, Steffen
You can compose your own set of elements:
initializeElements(c("C", "H", "N", "O", "P", "S", "Na"))
While at it, you could mention the minElements usage better,
decomposeMass(46.04186) will give you ethanol,
while decomposeMass(46.04186, minElements="C3")
gives no results.
decomposeMass(46.04186, minElements="C1") gives the reult again,
while decomposeMass(46.04186, minElements="C1H7") the expected empty result.
decomposition of CHNOPS works
sodium however does not (in two ways) 1)
fails with: Error in decomposeIsotopes(c(mass), c(1), ppm = ppm, mzabs = mzabs, elements = elements, : Exception: Na was not found in alphabet!
2) this returns an empty result:
(I guess because maxElements is 0 by default, but a warning would be good)
Same is true for other elements like Cl, Li, which are common adducts Lipidomics.