
Calculate m/z values of glycans
calculate_mz.RdThis function calculates m/z values from glycans. Different adducts, mass types, and derivatives are supported. Custom mass dictionaries are also supported.
Arguments
- glycans
Glycans to calculate m/z values from. Valid inputs include:
A
glyrepr::glycan_structure()vector.A
glyrepr::glycan_composition()vector.Byonic style composition strings (e.g. Hex(5)HexNAc(2)).
Simple style composition strings (e.g. H5N4F1S1).
Any structure strings supported by
glyparse::auto_parse().
- charge
Charge to use. Can be 0, 1, 2, 3, -1, -2, -3, etc. 0 means neutral. Default is 1.
- adduct
Adduct to use. Can be "H+", "K+", "Na+", "NH4+", "H-", "Cl-", "HCO3-". Default is "H+".
When
chargeis 0,adductis ignored.When
chargeis positive,adductcan only be "H+", "K+", "Na+", "NH4+".When
chargeis negative,adductcan only be "H-", "Cl-", "HCO3-".
- mass_dict
A named numeric vector of the mass of each monosaccharide residue. Default is
glyanno_mass_dict(deriv = "none", mass_type = "mono"). If a custom mass dictionary is provided, please make sure the names of the vector are the same as the names inglyanno_mass_dict().- safe
Whether to raise an error when unsupported monosaccharides or substituents are found.
If
TRUE(default), an error will be raised.If
FALSE, a warning will be raised and m/z values for invalid glycans will be set to NA.
Examples
library(glyrepr)
# Different input types
calculate_mz(glycan_composition(c(Gal = 1, GalNAc = 1)), charge = 0)
#> [1] 383.1428
calculate_mz("Gal(1)GalNAc(1)", charge = 0)
#> [1] 383.1428
calculate_mz(as_glycan_structure("Gal(b1-3)GalNAc(a1-"), charge = 0)
#> [1] 383.1428
calculate_mz("Gal(b1-3)GalNAc(a1-", charge = 0)
#> [1] 383.1428
# For common situation in MALDI-TOF MS
calculate_mz("Man(5)GlcNAc(2)", charge = 1,adduct = "Na+")
#> [1] 1257.423
# For common situation in ESI MS
calculate_mz("Man(5)GlcNAc(2)", charge = 1, adduct = "H+")
#> [1] 1235.441
# Calculate permethylated m/z values
calculate_mz("Man(5)GlcNAc(2)", charge = 0, mass_dict = glyanno_mass_dict(deriv = "permethyl"))
#> [1] 1556.793
# Calculate average mass
calculate_mz("Man(5)GlcNAc(2)", charge = 0, mass_dict = glyanno_mass_dict(mass_type = "average"))
#> [1] 1235.117
# Vectorization
calculate_mz(c("Man(5)GlcNAc(2)", "Gal(1)GalNAc(1)"), charge = 1, adduct = "Na+")
#> [1] 1257.4231 406.1325