rformassspectrometry / MetaboCoreUtils

Core utilities for metabolomics.
https://rformassspectrometry.github.io/MetaboCoreUtils/index.html
9 stars 6 forks source link

add possibility to use deuterium to "calculateMass()" #81

Closed mar-garcia closed 7 months ago

mar-garcia commented 8 months ago

Is it possible to include a "deuterated" element when calculating the exact mass of a formula? Using "D" is not possible... Not sure if it is not possible or maybe I'm using the wrong symbol.... In the former case, maybe could be nice to be able to use also deteurium as an element defining the chemical formula when using calculateMass().... For example, with "D" it is working if I use the Rdisop::getMolecule() function....

sgibb commented 7 months ago

Could you please provide an example formular with an expected mass?

Deuterium is currently supported using calculateMass("[2H]").

mar-garcia commented 7 months ago

Sure! Let's take tryptophan-d5 as example, with Rdisop package I would calculate the exact mass in this way Rdisop::getMolecule("C11D5H7N2O2")$exactmass

sgibb commented 7 months ago

You have to add [2Hx], e.g.:

Rdisop::getMolecule("C11D5H7N2O2")$exactmass
# [1] 209.1213

MetaboCoreUtils::calculateMass("C11[2H5]H7N2O2")
# C11[2H5]H7N2O2 
#       209.1213 

Please feel free to reopen if this solution doesn't fit.

jorainer commented 7 months ago

Great! Thanks for the feedback @mar-garcia and @sgibb - I guess it would make sense to add this as an example and to the vignette. I will do that.

mar-garcia commented 7 months ago

Sure! Good idea @jorainer! :) Thanks!