File size: 11,111 Bytes
e7962be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a03fc9f
 
e7962be
a03fc9f
48b5133
 
e7962be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a03fc9f
e7962be
 
 
 
a03fc9f
e7962be
 
 
 
 
 
a03fc9f
e7962be
a03fc9f
e7962be
 
a03fc9f
e7962be
a03fc9f
e7962be
 
 
 
 
a03fc9f
e7962be
 
 
 
a03fc9f
e7962be
 
 
a03fc9f
 
e7962be
a03fc9f
 
e7962be
 
a03fc9f
 
e7962be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a03fc9f
 
 
e7962be
 
 
 
a03fc9f
e7962be
a03fc9f
e7962be
 
 
a03fc9f
 
 
e7962be
 
 
a03fc9f
 
e7962be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a03fc9f
 
e7962be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
---
pretty_name: UltraMS MSnLib benchmark (formula-level split A + strict-adduct molecule-level split B)
license: cc-by-4.0
language:
  - en
size_categories:
  - 100K<n<1M
task_categories:
  - other
configs:
  - config_name: split_A_formula_split
    data_files: split_A_full_msnlib/formula_split.csv
  - config_name: split_A_row_formula_fold
    data_files: split_A_full_msnlib/row_formula_fold.csv
  - config_name: split_A_test_spectra
    data_files: split_A_full_msnlib/test_spectra.csv
  - config_name: split_A_val_spectra
    data_files: split_A_full_msnlib/val_spectra.csv
  - config_name: split_A_test_molecules_voting_official
    data_files: split_A_full_msnlib/test_molecules_voting.csv
  - config_name: split_A_test_molecules_voting_canonical_view
    data_files: split_A_full_msnlib/test_molecules_voting_canonical_view.csv
  - config_name: split_A_msnlib_rt
    data_files: split_A_full_msnlib/msnlib_rt.csv.gz
  - config_name: split_B_pos_compound_split
    data_files: splits/pos_compound_split.csv
  - config_name: split_B_neg_compound_split
    data_files: splits/neg_compound_split.csv
  - config_name: split_B_pos_val_queries
    data_files: queries/pos_val_queries.csv
  - config_name: split_B_pos_test_queries
    data_files: queries/pos_test_queries.csv
  - config_name: split_B_neg_val_queries
    data_files: queries/neg_val_queries.csv
  - config_name: split_B_neg_test_queries
    data_files: queries/neg_test_queries.csv
  - config_name: split_B_pos_val_library
    data_files: libraries/pos_val_library.csv
  - config_name: split_B_pos_test_library
    data_files: libraries/pos_test_library.csv
  - config_name: split_B_neg_val_library
    data_files: libraries/neg_val_library.csv
  - config_name: split_B_neg_test_library
    data_files: libraries/neg_test_library.csv
tags:
  - chemistry
  - mass-spectrometry
  - metabolomics
  - small-molecules
  - tandem-ms
  - spectrum-library-search
  - molecule-retrieval
  - benchmark
  - ultraMS
---

# UltraMS MSnLib benchmark

Zenodo DOI: [10.5281/zenodo.23963489](https://doi.org/10.5281/zenodo.23963489)

Two frozen, independent benchmark splits of the [MSnLib](https://doi.org/10.1038/s41592-025-02813-0)
tandem mass spectral library, released by UltraMS. The splits are different objects:

* **Split A — UltraMS MSnLib formula-level split** (all 560,084 spectra, all adducts):
  21,107 molecular formulas, split 16,885 / 2,110 / 2,112 formulas and
  446,667 / 55,980 / 57,437 spectra into train / validation / test. Formula-disjoint. Test
  fold: 57,437 spectra, 2,112 formulas, 5,003 source SMILES / 4,889 canonical molecules.
  Population for single-spectrum candidate ranking, multiple-spectrum voting, label-blind
  grouping, fingerprint prediction and embedding analyses (Figure 2b/2j, 3a/3b/3d/3g,
  3a_sp_4, 3a_sp_5, single-spectrum baselines). The **official multiple-spectrum voting
  units are the 5,002 MSnLib source-SMILES groups covering 57,436 spectra**
  (`test_molecules_voting.csv`); a canonical-SMILES alternative view (4,888 groups) is also
  provided (`test_molecules_voting_canonical_view.csv`). Per-spectrum retention times
  (`row_index, rt` in seconds) are in `msnlib_rt.csv.gz` for the label-blind grouping and
  multiple-spectrum voting analyses.
* **Split B — strict-adduct molecule-level split** (`[M+H]+` and `[M-H]-` only): 41,348 /
  21,293 compounds and 301,636 / 140,193 preprocessed spectra, split 70/15/15 per polarity
  by RDKit canonical isomeric SMILES, with frozen queries and libraries for
  spectrum-to-spectrum library search. Population for Figure 3e/3f/3h, 3h_sp_1 and the
  cross-collision-energy task (6,161 positive / 2,999 negative queries).

| split-B task | queries | library spectra | queries with an exact-adduct library positive |
| --- | ---: | ---: | ---: |
| `[M+H]+` test | 6,202 | 295,434 | 6,201 |
| `[M+H]+` validation | 6,202 | 250,424 | 6,194 |
| `[M-H]-` test | 3,193 | 137,000 | 3,160 |
| `[M-H]-` validation | 3,193 | 116,135 | 3,163 |

> **Disjointness.** Split A is formula-disjoint (no formula in two folds); split B is
> molecule-disjoint within each polarity (the train / validation / test compound sets are
> pairwise empty). The two splits must **not** be merged into a global-disjointness claim:
> about 41 % of split-B compounds lie in a different split-A fold, and a spectrum can be
> split-A test while its compound is split-B train. See the package
> `figures_mapping.md` §2 for the full cross-tabulation.

## Usage

```python
import pandas as pd

base = "https://huggingface.co/datasets/dsadd4/UltraMS-MSnLib-Benchmark/resolve/main/"

# split A — formula-level split of the full library
formulas = pd.read_csv(base + "split_A_full_msnlib/formula_split.csv")
rows = pd.read_csv(base + "split_A_full_msnlib/row_formula_fold.csv")      # 560,084 rows
test = pd.read_csv(base + "split_A_full_msnlib/test_spectra.csv")          # 57,437 rows
assert formulas.groupby("formula")["fold"].nunique().max() == 1

# split B — strict-adduct molecule-level library search
compound_split = pd.read_csv(base + "splits/pos_compound_split.csv")
queries = pd.read_csv(base + "queries/pos_test_queries.csv")
library = pd.read_csv(base + "libraries/pos_test_library.csv")

positives = library.groupby("canonical_isomeric_smiles").size()
n_pos = queries["canonical_isomeric_smiles"].map(positives).fillna(0).astype(int)
denominator = int((n_pos > 0).sum())      # 6,201
```

With `datasets` (one config per table, see the YAML header):

```python
from datasets import load_dataset
queries = load_dataset("dsadd4/UltraMS-MSnLib-Benchmark", "split_B_pos_test_queries", split="train")
```

Peak data are **not** part of the split tables. Every row is joined back to the spectra by
`row_index` / `msnlib_csv_data_row` / `first_msnlib_csv_data_row`, which point into
`MSnLib.csv`. `MSnLib.csv` and `MSnLib_candidates.json` are hosted in the same dataset; see
**Hosted files** below.

## Columns

* `split_A_full_msnlib/formula_split.csv`: `formula, fold, n_spectra`
* `split_A_full_msnlib/row_formula_fold.csv`: `row_index, formula, fold`
* `split_A_full_msnlib/{test,val}_spectra.csv`: `row_index, smiles, precursor_mz, adduct,
  collision_energy, fold, canonical_isomeric_smiles`
* `split_A_full_msnlib/test_molecules_voting.csv`: `group_id, smiles, n_spectra` —
  **official** voting units: 5,002 MSnLib-source-SMILES groups covering 57,436 spectra, the
  grouping of the published multiple-spectrum voting task (`n_molecules = 5002`)
* `split_A_full_msnlib/test_molecules_voting_canonical_view.csv`: `group_id,
  canonical_isomeric_smiles, n_spectra` — alternative canonical view: 4,888 groups covering
  the same 57,436 spectra
* `split_A_full_msnlib/msnlib_rt.csv.gz`: `row_index, rt` — per-spectrum retention time in
  seconds, aligned 1:1 to the `MSnLib.csv` data rows (560,084 rows)
* `splits/*_compound_split.csv`: `polarity, compound_id, canonical_isomeric_smiles, split,
  n_spectra, n_frozen_queries, n_raw_smiles_variants, first_msnlib_csv_data_row`
* `queries/*.csv`: `polarity, split, query_index, compound_id, canonical_isomeric_smiles,
  adduct, msnlib_csv_data_row, msnlib_csv_line, precursor_mz, n_peaks, collision_energy,
  source_smiles_raw, n_library_positives`
* `libraries/*.csv`: same as queries with `library_index` and `compound_split` instead of
  `query_index`; row order is the frozen library order

## Split-B evaluation protocol

1. Score every query against the complete library of its task (no candidate short list).
2. Correct = the top-1 library spectrum has the same canonical compound identity.
3. Empirical FDR = `(accepted − correct) / accepted`; identification recall =
   `correct / n_queries_with_library_positive` (6,201 / 3,160 for the two test tasks).
   Queries without a library positive enter the FDR denominator but not the recall
   denominator; `n_library_positives` is provided per query.
4. The test library contains all preprocessed spectra of the polarity except the selected
   test queries; the validation library contains train and validation compounds only.
5. Validation is for model selection only; evaluate the test fold once.

## Hosted files

The dataset hosts the complete manifest plus two large source files. Every file of the
manifest is checksummed in `SHA256SUMS`; the two large files are kept in a separate upload
step (see `hf_upload_commands.sh`, dry-run by default).

| hosted file | bytes | SHA-256 | purpose |
| --- | ---: | --- | --- |
| manifest: `split_A_full_msnlib/`, `splits/`, `queries/`, `libraries/`, `protocol/`, `rebuild/`, docs (59 files) | ≈ 185.2 MiB | see `SHA256SUMS` | the two benchmark splits, verifier, docs |
| `split_A_full_msnlib/msnlib_rt.csv.gz` | 1,483,069 | `994053612db874f7ac7985f278e04cc3463f3b93cd649a195bd167c4c6c7d3d8` | compact per-spectrum retention time (`row_index, rt` in seconds), aligned 1:1 to `MSnLib.csv`; used by the label-blind grouping analysis |
| `MSnLib.csv` | 752,707,651 | `be54b33039cf18675751ea3c6354b592177c899a0cd5df303ae616330133ec07` | full source CSV: one row per MSnLib spectrum (560,084 rows); every row pointer in the split tables resolves here |
| `MSnLib_candidates.json` | 1,368,264,026 | `125a1cdcc57a3fcef8cc76d5322ac0c434cd09b0bfb9e0c9d28bddf052f45fcc` | candidate SMILES lists behind the single-spectrum candidate-ranking task: a JSON object mapping a query SMILES string to its candidate SMILES list (9,886 query entries) |

`MSnLib.csv` is the UltraMS CSV conversion of the MSnLib original release (Zenodo
10.5281/zenodo.11163380, CC BY 4.0), whose 18 per-file MS2 JSONL record lists contain the
same 560,084 spectra. `MSnLib_candidates.json` contains candidate SMILES lists derived from
the MSnLib compound set; both files carry the MSnLib attribution.

## Provenance, verification, license

* Source rows: `MSnLib.csv` (560,084 rows) converted from the MSnLib original release
  (Brungs et al., CC BY 4.0; Zenodo 10.5281/zenodo.11163380).
* Hosted source files: `MSnLib.csv` (752,707,651 bytes, SHA-256 `be54b330…`) and
  `MSnLib_candidates.json` (1,368,264,026 bytes, SHA-256 `125a1cdc…`).
* Frozen split-B manifest, seeds 42 / 43, query seed 119; frozen split-A fold assignment
  from the `fold` column of `MSnLib.csv`.
* `SHA256SUMS` covers every file; `rebuild/verify_release.py` is a self-contained verifier
  that re-checks every count, ordering hash, disjointness statement, cross-split statistic
  and checksum offline.
* License **CC BY 4.0**, with attribution to MSnLib (CC BY 4.0); Apache-2.0 for the two
  UltraMS producer scripts. See the package `NOTICE.md`.

## Citation

```bibtex
@misc{ultrams_msnlib_benchmark_2026,
  title  = {UltraMS MSnLib benchmark: full-library formula-level split and strict-adduct molecule-level library-search split},
  author = {Li, Yifan and Zhong, Yunhua and Liu, Pan and Xia, Jun},
  year   = {2026},
  note   = {Derived from MSnLib (Brungs, Schmid, Pluskal; CC BY 4.0, Zenodo 10.5281/zenodo.11163380)},
  howpublished = {Hugging Face / Zenodo dataset, version 1.0.0}
}
```

Please also cite MSnLib (doi:10.1038/s41592-025-02813-0) and the UltraMS manuscript.