Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Mass spectrometry analysis. Process mzML/MGF/MSP, spectral similarity (cosine, modified cosine), metadata harmonization, compound ID, for metabolomics and MS data processing.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-03 | ✗→✓ | ▲ Improved | — | — |
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-10 | ✗→✓ | ▲ Improved | — | — |
| case-16 | ✗→✓ | ▲ Improved | — | — |
Matchms is an open-source Python library for mass spectrometry data processing and analysis. Import spectra from various formats, standardize metadata, filter peaks, calculate spectral similarities, and build reproducible analytical workflows.
Load spectra from multiple file formats and export processed data:
pythonfrom matchms.importing import load_from_mgf, load_from_mzml, load_from_msp, load_from_json from matchms.exporting import save_as_mgf, save_as_msp, save_as_json # Import spectra spectra = list(load_from_mgf("spectra.mgf")) spectra = list(load_from_mzml("data.mzML")) spectra = list(load_from_msp("library.msp")) # Export processed spectra save_as_mgf(spectra, "output.mgf") save_as_json(spectra, "output.json")
Supported formats:
For detailed importing/exporting documentation, consult references/importing_exporting.md.
Apply comprehensive filters to standardize metadata and refine peak data:
pythonfrom matchms.filtering import default_filters, normalize_intensities from matchms.filtering import select_by_relative_intensity, require_minimum_number_of_peaks # Apply default metadata harmonization filters spectrum = default_filters(spectrum) # Normalize peak intensities spectrum = normalize_intensities(spectrum) # Filter peaks by relative intensity spectrum = select_by_relative_intensity(spectrum, intensity_from=0.01, intensity_to=1.0) # Require minimum peaks spectrum = require_minimum_number_of_peaks(spectrum, n_required=5)
Filter categories:
Matchms provides 40+ filters. For the complete filter reference, consult references/filtering.md.
Compare spectra using various similarity metrics:
pythonfrom matchms import calculate_scores from matchms.similarity import CosineGreedy, ModifiedCosine, CosineHungarian # Calculate cosine similarity (fast, greedy algorithm) scores = calculate_scores(references=library_spectra, queries=query_spectra, similarity_function=CosineGreedy()) # Calculate modified cosine (accounts for precursor m/z differences) scores = calculate_scores(references=library_spectra, queries=query_spectra, similarity_function=ModifiedCosine(tolerance=0.1)) # Get best matches best_matches = scores.scores_by_query(query_spectra[0], sort=True)[:10]
Available similarity functions:
For detailed similarity function documentation, consult references/similarity.md.
Create reproducible, multi-step analysis workflows:
pythonfrom matchms import SpectrumProcessor from matchms.filtering import default_filters, normalize_intensities from matchms.filtering import select_by_relative_intensity, remove_peaks_around_precursor_mz # Define a processing pipeline processor = SpectrumProcessor([ default_filters, normalize_intensities, lambda s: select_by_relative_intensity(s, intensity_from=0.01), lambda s: remove_peaks_around_precursor_mz(s, mz_tolerance=17) ]) # Apply to all spectra processed_spectra = [processor(s) for s in spectra]
The core Spectrum class contains mass spectral data:
pythonfrom matchms import Spectrum import numpy as np # Create a spectrum mz = np.array([100.0, 150.0, 200.0, 250.0]) intensities = np.array([0.1, 0.5, 0.9, 0.3]) metadata = {"precursor_mz": 250.5, "ionmode": "positive"} spectrum = Spectrum(mz=mz, intensities=intensities, metadata=metadata) # Access spectrum properties print(spectrum.peaks.mz) # m/z values print(spectrum.peaks.intensities) # Intensity values print(spectrum.get("precursor_mz")) # Metadata field # Visualize spectra spectrum.plot() spectrum.plot_against(reference_spectrum)
Standardize and harmonize spectrum metadata:
python# Metadata is automatically harmonized spectrum.set("Precursor_mz", 250.5) # Gets harmonized to lowercase key print(spectrum.get("precursor_mz")) # Returns 250.5 # Derive chemical information from matchms.filtering import derive_inchi_from_smiles, derive_inchikey_from_inchi from matchms.filtering import add_fingerprint spectrum = derive_inchi_from_smiles(spectrum) spectrum = derive_inchikey_from_inchi(spectrum) spectrum = add_fingerprint(spectrum, fingerprint_type="morgan", nbits=2048)
For typical mass spectrometry analysis workflows, including:
Consult references/workflows.md for detailed examples.
bashuv pip install matchms
For molecular structure processing (SMILES, InChI):
bashuv pip install matchms[chemistry]
Detailed reference documentation is available in the references/ directory:
filtering.md - Complete filter function reference with descriptionssimilarity.md - All similarity metrics and when to use themimporting_exporting.md - File format details and I/O operationsworkflows.md - Common analysis patterns and examplesLoad these references as needed for detailed information about specific matchms capabilities.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +59 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.