rformassspectrometry / MetaboCoreUtils

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

PR: add formula2mz, adductFormula and multiplyElements #56

Closed RogerGinBer closed 2 years ago

RogerGinBer commented 2 years ago

Hi there!

I've been working on creating a formula2mz function that, given a molecular formula and a set of adducts, calculates the corresponding mz values as a matrix (#55) and also an adductFormula function that, given the same kind of input, calculates the "adduct formula" corresponding to the ion species (#12).

Although no issue was made beforehand, I've found necessary to create a multiplyElements functions (in line with addElements and subtractElements) to multiply a formula by a positive integer to calculate dimer/trimer/etc. adduct formulas.

I've created unit tests and documentation for all new functions and checked that we are passing R CMD Check

Cheers, Roger