This function parses adducts
Usage
parse_adduct(
adduct_string,
regex = "\\[(\\d*)M(?![a-z])(\\d*)([+-][\\w\\d].*)?.*\\](\\d*)([+-])?"
)
Arguments
- adduct_string
Adduct to be parsed
- regex
Regex used for parsing
Value
Parsed elements from adduct
Examples
parse_adduct("[M+H]+")
#> n_mer n_iso los_add_clu n_charges charge
#> 1.000000 0.000000 1.007825 1.000000 1.000000
parse_adduct("[2M1-C6H12O6 (hexose)+NaCl+H]2+")
#> n_mer n_iso los_add_clu n_charges charge
#> 2.0000 1.0000 -180.0634 2.0000 1.0000