MSbox

CRAN status CRAN downloads

Common mass spectrometry tools for minimalist MS users.

Installation

## development version
devtools::install_github("YonghuiDong/MSbox")

## stable version
install.packages('MSbox')

Functions

  1. Check element isotopes

examples:

E_iso('C') # element symbol, case insensitive
E_iso('Carbon') # element full name, case insensitive
E_iso('carBon') # element full name, case insensitive
  1. Get extra molecular information based on compound name

Attention : The function and output are a bit different between MSbox package downloaded from CRAN and Github

examples in MSbox package from CRAN, it the queried information is not found for any compound, it will stop and pops up an error:

get_formula('malic acid')
get_formula(c('malic acid', 'citric acid', 'tartaric acid'))

examples in MSbox package from Github, it the queried information is not found for a compounds, it will assign “unknown” to that compound:

describe('malic acid') # get formula by default
describe(c('malic acid', 'citric acid', 'tartaric acid'), representation = "smiles") # get smiles
  1. Calculate monoisitopic mass

example:

mass('C7H6O1') # case insensitive
mass(c('K1', 'C5H8', 'nA20')) # vector input
  1. Calculate exact m/z values

example:

mz('C7H7O4', z = -1) # case insensitive
mz(c('C7H7O4', 'c1'), z = -1) # vector input
  1. Calculate the mass accuracy of measured m/z

examples:

ppm(155.03383, 155.03388) # with m/z value
ppm(155.03383, .03388) # lazy input when the integer parts of m and t are the same
ppm(155.03383, .03388, lazy = F) # lazy input disabled
ppm(155.03384, mz('C7H7O4', z = 1)) # with ion formula
  1. Calculate isotope labelled molecular mass

example

Iso_mass(F = 'C7H6O4', iso = '[13]C2[2]H3') # Two 13C and three 2H are labled. Case insensitive.
  1. Calculate isotope labelled m/z

example

Iso_mz(F = 'C7H6O4', iso = '[13]C2[2]H3', z = 1) # Two 13C and three 2H are labled. Case insensitive.
  1. Check if an m/z value originates from possible contaminant

examples

contam(33.0335, ppm = 10, mode = '+')
contam(44.998, ppm = 10, mode = '-')
  1. Calculate common adduct ions in pos or neg ion mode

examples

adduct('C1H4', mode = '-') # case insensitive
adduct('C1H4', mode = '+') # case insensitive
  1. Annotate the m/z values according to m/z value matching
what(1034.556, mode = "+", ppm = 3) # single m/z value

mzs <- rep(133.014, 300)
what(mzs, "-") # multiple m/z values, default ppm = 5