Automatically generate a transformation product library with formula data.
Source:R/TP-library_formula.R
genFormulaTPLibrary.RdFunctionality to automatically generate a TP library with formula data from a set of transformation rules, which can
be used with generateTPsLibraryFormula. TP calculation will be skipped if the transformation involves
subtraction of elements not present in the parent.
Usage
genFormulaTPLibrary(
parents,
transformations = NULL,
minMass = 40,
generations = 1,
skipInvalid = TRUE,
prefCalcChemProps = TRUE,
neutralChemProps = FALSE
)Arguments
- parents
The parents to which the given transformation rules should be used to generate the TP library. Should be either a suspect list (see suspect screening for more information) or the resulting output of
screenSuspects.- transformations
A
data.framewith transformation reactions to be used for calculating the TPs (see details below). IfNULL, a default table from Schollee et al. is used, that can be obtained withTPLogicTransformations.- minMass
The minimum mass for a TP to be kept.
- generations
An
integerthat specifies the number of transformation generations that should be calculated. Ifgenerations>1then TPs are calculated by applying the transformation rules to the TPs generated in the previous generation.- skipInvalid
Set to
TRUEto skip parents without formula information. Otherwise an error is thrown.- prefCalcChemProps
If
TRUEthen calculated chemical properties such as the formula and InChIKey are preferred over what is already present in the parent suspect list. For efficiency reasons it is recommended to set this toTRUE. See theValidating and calculating chemical propertiessection for more details.- neutralChemProps
If
TRUEthen the neutral form of the molecule is considered to calculate SMILES, formulae etc. Enabling this may improve feature matching when considering common adducts (e.g.[M+H]+,[M-H]-). See theValidating and calculating chemical propertiessection for more details.
Value
A data.table that is suitable for the TPLibrary argument to
generateTPsLibraryFormula.
Transformation reactions
The transformations argument specifies custom rules to calculate
transformation products. This should be a data.frame with the following columns:
transformationThe name of the chemical transformationaddThe elements that are added by this reaction (e.g."O").subThe elements that are removed by this reaction (e.g."H2O").retDirThe expected retention order direction.
Source
The algorithms using transformation reactions are directly based on the work done by Schollee et al. (see references).
Validating and calculating chemical properties
Chemical properties such as SMILES, InChIKey and formulae in the parent suspect list are automatically validated and calculated if missing/invalid.
The internal validation/calculation process performs the following steps:
Validation of SMILES, InChI, InChIKey and formula data (if present). Invalid entries will be set to
NA.If
neutralChemProps=TRUEthen chemical data (SMILES, formulae etc.) is neutralized by (de-)protonation (using the–neutralizedoption ofOpenBabel). An additional columnmolNeutralizedis added to mark those molecules that were neutralized. Note that neutralization requires either SMILES or InChI data to be available.The SMILES and InChI data are used to calculate missing or invalid SMILES, InChI, InChIKey and formula data. If
prefCalcChemProps=TRUEthen existing InChIKey and formula data is overwritten by calculated values whenever possible.The chemical formulae which were not calculated are verified and normalized. This process may be time consuming, and is potentially largely avoided by setting
prefCalcChemProps=TRUE.Neutral masses are calculated for missing values (
prefCalcChemProps=FALSE) or whenever possible (prefCalcChemProps=TRUE).
Note that calculation of formulae for molecules that are isotopically labelled is currently only supported for deuterium (2H) elements.
This functionality relies heavily on OpenBabel, please make sure it is installed.
References
Schollee JE, Schymanski EL, Avak SE, Loos M, Hollender J (2015). “Prioritizing Unknown Transformation Products from Biologically-Treated Wastewater Using High-Resolution Mass Spectrometry, Multivariate Statistics, and Metabolic Logic.” Analytical Chemistry, 87(24), 12121–12129. doi:10.1021/acs.analchem.5b02905 .
OBoyle NM, Banck M, James CA, Morley C, Vandermeersch T, Hutchison GR (2011). “Open Babel: An open chemical toolbox.” Journal of Cheminformatics, 3(1). doi:10.1186/1758-2946-3-33 .