rformassspectrometry / MetaboCoreUtils

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

mass2mz and mz2mass to support multiple adducts #29

Closed jorainer closed 3 years ago

jorainer commented 3 years ago

Currently mass2mz and mz2mass allow only to convert mass to m/z or vice-versa for a single adduct. Would be nice to support calls such as e.g.

mass2mz(c(312.43, 431.21, 322.21), adducts = c("[M+H]+", "[M+Na]+"))

and I would suggest that this call would return a matrix with 3 rows (one row per mass) and 2 columns (one column per adduct). That should be pretty efficient to calculate and it would also support extracting then just e.g. one adduct etc.

@michaelwitting any thoughts?

michaelwitting commented 3 years ago

Agreed! Great idea.