Mass spectrometry (MS) data backend supporting import and export of MS/MS library spectra from MassBank record files. Different backends are available that allow handling of data in plain MassBank text file format or allow also to interact directly with MassBank SQL databases. Objects from this package are supposed to be used with the Spectra Bioconductor package. This package thus adds MassBank support to the Spectra package.
Input: A character vector of paths to MassBank text files. Output: A Spectra object containing the imported mass spectrometry data.
When to Use
Importing and exporting MS/MS library spectra from MassBank record files (plain text format) into Spectra objects.
Querying and interacting directly with a local MassBank SQL database (MySQL or SQLite) using MsBackendMassbankSql.
Comparing spectra similarity and generating mirror plots using compareSpectra and plotSpectraMirror.
When NOT to Use
For raw LC-MS data processing (e.g., peak picking, retention time correction), use xcms.
For handling non-MassBank formats like mzML or mzXML without MassBank metadata, use standard Spectra backends like MsBackendMzR.
Data Requirements
Plain text files in MassBank record format (one file per spectrum), or a local SQL database containing MassBank release dumps.
Key Parameters
source: An instance of MsBackendMassbank() or MsBackendMassbankSql() specifying the data source.
backend: An instance of MsBackendDataFrame() or other Spectra backends to store the imported data.
nonStop (FALSE): If TRUE, prevents the import from stopping when problematic MassBank files are encountered.
metaBlock: Configured blocks of metadata fields to import, generated by metaDataBlocks(ac = TRUE, ms = TRUE).
ppm (40): Parts-per-million tolerance for m/z matching in compareSpectra or plotSpectraMirror.
Best Practices
Set nonStop = TRUE when importing a large number of MassBank files to prevent a single malformed file from crashing the process.
Use dropNaSpectraVariables to remove imported spectra variables that contain only missing values across all spectra.
Use MsBackendMassbankSql for large-scale analyses to fetch data on demand from a local SQL database instead of loading thousands of text files into memory.
Common Pitfalls
Attempting parallel processing with MsBackendMassbankSql: The database connection cannot be shared across parallel processes, so parallel processing is silently disabled.
Slow import times: Importing all metadata blocks can be slow; customize the imported blocks using metaDataBlocks or use the SQL backend.
Alternatives
Spectra with MsBackendDataFrame for in-memory generic spectrum handling.
MsCoreUtils for low-level mass spectrometry helper functions.
1---2name: msbackendmassbank3description: MsBackendMassbank4---56# MsBackendMassbank78## Workflows910### Standard Workflow1112Mass spectrometry (MS) data backend supporting import and export of MS/MS library spectra from MassBank record files. Different backends are available that allow handling of data in plain MassBank text file format or allow also to interact directly with MassBank SQL databases. Objects from this package are supposed to be used with the Spectra Bioconductor package. This package thus adds MassBank support to the Spectra package.1314```r15library(Spectra)16library(MsBackendMassbank)17fls <- dir(system.file("extdata", package = "MsBackendMassbank"), full.names = TRUE, pattern = "txt$")18sps <- Spectra(fls, source = MsBackendMassbank(), backend = MsBackendDataFrame(), nonStop = TRUE)19sps <- dropNaSpectraVariables(sps)20```21Input: A character vector of paths to MassBank text files. Output: A `Spectra` object containing the imported mass spectrometry data.2223## When to Use24- Importing and exporting MS/MS library spectra from MassBank record files (plain text format) into `Spectra` objects.25- Querying and interacting directly with a local MassBank SQL database (MySQL or SQLite) using `MsBackendMassbankSql`.26- Comparing spectra similarity and generating mirror plots using `compareSpectra` and `plotSpectraMirror`.2728## When NOT to Use29- For raw LC-MS data processing (e.g., peak picking, retention time correction), use `xcms`.30- For handling non-MassBank formats like mzML or mzXML without MassBank metadata, use standard `Spectra` backends like `MsBackendMzR`.3132## Data Requirements33- Plain text files in MassBank record format (one file per spectrum), or a local SQL database containing MassBank release dumps.3435## Key Parameters36- **source**: An instance of `MsBackendMassbank()` or `MsBackendMassbankSql()` specifying the data source.37- **backend**: An instance of `MsBackendDataFrame()` or other `Spectra` backends to store the imported data.38- **nonStop** (FALSE): If `TRUE`, prevents the import from stopping when problematic MassBank files are encountered.39- **metaBlock**: Configured blocks of metadata fields to import, generated by `metaDataBlocks(ac = TRUE, ms = TRUE)`.40- **ppm** (40): Parts-per-million tolerance for m/z matching in `compareSpectra` or `plotSpectraMirror`.4142## Best Practices43- Set `nonStop = TRUE` when importing a large number of MassBank files to prevent a single malformed file from crashing the process.44- Use `dropNaSpectraVariables` to remove imported spectra variables that contain only missing values across all spectra.45- Use `MsBackendMassbankSql` for large-scale analyses to fetch data on demand from a local SQL database instead of loading thousands of text files into memory.4647## Common Pitfalls48- Attempting parallel processing with `MsBackendMassbankSql`: The database connection cannot be shared across parallel processes, so parallel processing is silently disabled.49- Slow import times: Importing all metadata blocks can be slow; customize the imported blocks using `metaDataBlocks` or use the SQL backend.5051## Alternatives52- `Spectra` with `MsBackendDataFrame` for in-memory generic spectrum handling.53- `MsCoreUtils` for low-level mass spectrometry helper functions.5455## Citations56- Witting, Rainer, Stravs 2026, MsBackendMassbank (vignette documentation)5758## References59- Homepage: bioconductor.org/packages/MsBackendMassbank60- Vignette: https://bioconductor.org/packages/release/bioc/vignettes/MsBackendMassbank/inst/doc/MsBackendMassbank.html
Run npx skillmds@latest add biomate-ai/msbackendmassbank in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
MsBackendMassbank It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
biomate-ai (@biomate-ai) published this skill. Their other Agent Skills are listed on their SkillMD profile.