addMolecules: Add/subtract sum formulas

View source: R/addMolecules.R

addMoleculesR Documentation

Add/subtract sum formulas

Description

Simple arithmetic modifications of sum formulas.

Usage

addMolecules(formula1, formula2, elements = NULL, maxisotopes = 10)

subMolecules(formula1, formula2, elements = NULL, maxisotopes = 10)

Arguments

formula1

Sum formula (can be a vector).

formula2

Sum formula.

elements

List of allowed chemical elements, defaults to full periodic system of elements. See initializeElements.

maxisotopes

Maximum number of isotopes shown in the resulting molecules.

Details

'addMolecules' adds the second argument to the first. 'subMolecules' subtracts the second argument from the first. This can be useful to revert e.g. adduct/fragment formation found in ESI mass spectrometry, or to mimic simple chemical reactions. No chemical checks are performed.

Value

The input vector formula1 will be converted into molecule objects similar to function getMolecule. However, the results will be amended or reduced by formula2.

Examples

# Remove the proton-adduct from Ethanol
subMolecules("C2H7O", "H")


sneumann/Rdisop documentation built on Nov. 19, 2024, 12:42 a.m.