Liquid chromatography-mass spectrometry (LC-MS)-based untargeted metabolomics experiments have become increasingly popular because of the wide range of metabolites that can be analyzed and the possibility to measure novel compounds. LC-MS instrumentation and analysis conditions can differ substantially among laboratories and experiments, thus resulting in non-standardized datasets demanding customized annotation workflows. We present an ecosystem of R packages, centered around the MetaboCoreUtils, MetaboAnnotation and CompoundDb packages that together provide a modular infrastructure for the annotation of untargeted metabolomics data. Initial annotation can be performed based on MS1 properties such as m/z and retention times, followed by an MS2-based annotation in which experimental fragment spectra are compared against a reference library. Such reference databases can be created and managed with the CompoundDb package. The ecosystem supports data from a variety of formats, including, but not limited to, MSP, MGF, mzML, mzXML, netCDF as well as MassBank text files and SQL databases. Through its highly customizable functionality, the presented infrastructure allows to build reproducible annotation workflows tailored for and adapted to most untargeted LC-MS-based datasets. All core functionality, which supports base R data types, is exported, also facilitating its re-use in other R packages. Finally, all packages are thoroughly unit-tested and documented and are available on GitHub and through Bioconductor.
Machine learning tools have become essential for annotating the vast number of unidentified MS/MS spectra in metabolomics, addressing the limitations of current reference spectral libraries. However, these tools often struggle with the high dimensionality and sparsity of MS/MS spectra and metabolite structures. ChemEmbed introduces a novel approach by combining multidimensional and continuous vector representations of chemical structures with enhanced MS/MS spectra. This enhancement is achieved by merging spectra from multiple collision energies and incorporating calculated neutral losses from 38,472 distinct compounds, providing richer input for a convolutional neural network (CNN). ChemEmbed achieves top-ranked candidate annotations in over 42% of cases and identifies the correct compound within the top five in more than 76% of cases in a test dataset. Against external benchmarks such as CASMI 2016 and 2022, ChemEmbed outperforms SIRIUS, the current state-of-the-art in computational metabolomics. In a validation experiment with the Annotated Recurrent Unidentified Spectra (ARUS) dataset— including over 25,000 spectra from human plasma and 68,000 from urine— ChemEmbed successfully identified 24 previously unannotated compounds. By aligning with the advanced capabilities of modern mass spectrometry instrumentation, ChemEmbed balances accuracy, computational efficiency, and scalability, making it a powerful solution for high-throughput metabolomics applications.