Molecularweight¶
- computeMW(model, metList, warnings, generalFormula, isotopeAbundance)[source]¶
Computes molecular weight and elemental matrix of compounds
- USAGE
[MW, Ematrix, elements, knownWeights, unknownElements] = computeMW (model, metList, warnings, generalFormula, isotopeAbundance)
- INPUT
model – COBRA model structure (must define .mets and .metFormulas)
- OPTIONAL INPUTS
metList – Cell array of which metabolites to search for. (Default = all metabolites in model)
warnings – Display warnings if there are errors with the formula. (Default = true)
generalFormula –
(default) false to calculate MWs for formulae containing consisting of common biological elements using their mass numbers (instead of the standard atomic mass)
true to support formulae with brackets, decimal places and any chemical elements including undefined groups (e.g., ‘([H2O]2(CuSO4))2Generic_element0.5’). MW = NaN for any formulae with chemical elements of unknown weights except the reserved formula ‘Mass0’ for denoting truly massless metabolites (e.g., photon)
(isotopeAbundance is used only if genericFormula = true)
isotopeAbundance –
(default) false to use standard atomic weights
- true to use the weights of naturally predominant isotopes for biological
elements and standard weights for other elements.
- m x 3 cell arrray with user defined isotope abundance:
isotopeAbundance{i, 1} = ‘Atomic_Symbol’; isotopeAbundance{i, 2} = Mass_Number; isotopeAbundance{i, 3} = abundance; (where sum of abundances of all isotopes of an element must be one)
- OUTPUTS
MW – Vector of molecular weights
Ematrix –
m x 6 matrix of order [C N O H P other] if genericFormula = false
m x e matrix if genericFormula = true given e elements in the chemical formulae
element – cell array of elements corresponding to the columns of Ematrix
(knownWeights and unknownElements are non-empty only if genericFormula = true)
knownWeights – MWs for the part whose MW is computable ofr each of the formulae
unknownElements – cell arrary of elements without known atomic weights that appear in the formulae
- getMolecularMass(formulae, isotopeAbundance, generalFormula)[source]¶
Gets monoisotopic exact molecular mass for a single formula or a cell array of formulae using the relative atomic mass of the most abundant isotope of each element as specified by NIST http://physics.nist.gov/PhysRefData/Compositions/
An atomic weight of an element from a specified source is the ratio of the average mass per atom of the element to 1/12 of the mass of an atom of 12C.
Note the term “relative atomic mass” is usually reserved for the mass of a specific nuclide (or isotope), while “atomic weight” is usually used for the weighted mean of the relative atomic mass over all the atoms in the sample (polyisotopic mass).
If the ratio of the different isotopes are known exactly, this may be provided in the m x 3 cell array of m isotopes, i.e. isotopeAbundance.
By default, this script gives the molecular mass assuming monoisotopic exact mass.
- USAGE
[Masses, knownMasses, unknownElements, Ematrix, elements] = getMolecularMass (formulae, isotopeAbundance, generalFormula)
- INPUT
formulae – single formula or a cell array of formulae
- OPTIONAL INPUTS
isotopeAbundance – {(1), 0} where:
1 = monoisotopic exact mass i.e. only uses naturally predominant isotope of each element.
0 = polyisotopic inexact mass i.e. uses all isotopes of each element weighted by natural abundance
or
m x 3 cell arrray with user defined isotope abundance: isotopeAbundance{i, 1} = ‘Atomic_Symbol’; isotopeAbundance{i, 2} = Mass_Number; isotopeAbundance{i, 3} = abundance; (where sum of abundances of all isotopes of an element must be one)
- generalFormula * (false) – Return Masses = 0 if a formula contains none of these elements.
(C, O, P, N, S, H, Mg, Na, K, Cl, Ca, Zn, Fe, Cu, Mo, I)
true to support formulae with brackets, decimal places and any chemical elements including undefined groups (e.g., ‘([H2O]2(CuSO4))2Generic_element0.5’). Return Masses = NaN for any formulae with chemical elements of unknown weights except the reserved formula ‘Mass0’ for denoting truly massless metabolites (e.g., photon)
- OUTPUT
Masses – molecular mass(es) in (gram/Mol)
(the below are non-empty only if general = true)
knownWeights – MWs for the part whose MW is computable ofr each of the formulae
unknownElements – cell arrary of elements without known atomic weights that appear in the formulae
Ematrix – elemental composition matrix (#formulae x #elements)
element – cell array of elements corresponding to the columns of Ematrix
Example
% e.g. Carbon, all as C13 isotopeAbundance{i,1}= ‘C’ isotopeAbundance{i,2}= 12; isotopeAbundance{i,3}= 0; isotopeAbundance{i+1,1}= ‘C’ isotopeAbundance{i+1,2}= 13; isotopeAbundance{i+1,3}= 1; isotopeAbundance{i+2,1}= ‘C’ isotopeAbundance{i+2,2}= 14; isotopeAbundance{i+2,3}= 0;
Note
Exact mass check: If you want to double check that the mass given by this script is correct then compare it to either
OpenBabel: echo “InChIstring” | obabel -iinchi - -oreport or
Please report any errors as these are critical for use of this script with mass spec machines.