Isotope and adduct annotation of LC-MS feature groups.
One compound gives many LC-MS features: its quasi-molecular ion, other adducts, in-source fragments and the isotopes of all of these, its ion family. groupFeatures() from MsFeatures and xcms groups features that come from the same compound. IonFamilies annotates the ion family within each group:
-
annotateIsotopes()finds isotope patterns withMetaboCoreUtils::isotopologues(). -
annotateAdducts()finds adducts and fragments by neutral-mass voting with a rule list (by default from commonMZ). All supported hypotheses are kept and ranked, because the annotations are hints and a missed true annotation is worse than a coincidental one.
Results go into featureDefinitions() of the XcmsExperiment: isotopes and adduct hold the labels as text in CAMERA’s syntax, and the grouping is the feature_group column from groupFeatures(). All hypotheses are kept in the list column adduct_hints (adductHints()), and the parameters in metadata(x)$IonFamilies.
library(xcms)
library(MsFeatures)
library(IonFamilies)
x <- groupFeatures(x, SimilarRtimeParam(diffRt = 3))
x <- groupFeatures(x, AbundanceSimilarityParam(threshold = 0.7, transform = log2))
x <- annotateIsotopes(x, IsotopologueParam(ppm = 10))
x <- annotateAdducts(x, AdductVoteParam(polarity = "positive", nBest = 3))
featureDefinitions(x)[, c("feature_group", "isotopes", "adduct")]
adductHints(x)Status
Early development (0.99.x, the Bioconductor pre-release numbering). Documentation: https://stanstrup.github.io/IonFamilies. The package follows the RforMassSpectrometry and Bioconductor conventions so that it could be contributed there later.
Development notes
- Commit messages follow Conventional Commits (
feat:,fix:,docs:,test:,refactor:,style:,build:,ci:). - Parts of the code were written with the help of an AI assistant (Claude, Anthropic) and reviewed by the maintainer. This is disclosed as the RforMassSpectrometry contribution guidelines ask.
-
data/adductRules.rdais generated byinst/scripts/make-adductRules.R. - Releases are made by semantic-release from the commit messages (GitHub Actions,
.github/workflows/release.yaml); versions stay in 0.99.x. - The pkgdown site is built and deployed to the
gh-pagesbranch by.github/workflows/pkgdown.yaml.