UltraMS-MSnLib-Benchmark / figures_mapping.md
dsadd4's picture
Upload folder using huggingface_hub
a03fc9f verified
|
Raw History Blame Contribute Delete
8.51 kB

Figure → split mapping

This package contains the two frozen MSnLib splits behind the UltraMS manuscript. They are different objects and answer different questions:

  • Split A — UltraMS MSnLib formula-level split (split_A_full_msnlib/): the complete MSnLib library (560,084 spectra, all adducts) split by molecular formula into 16,885 / 2,110 / 2,112 formulas and 446,667 / 55,980 / 57,437 spectra (train / validation / test). Formula-disjoint, not molecule-disjoint. Test fold: 57,437 spectra, 2,112 formulas, 5,003 source SMILES / 4,889 canonical molecules.
  • Split B — strict-adduct molecule-level split (splits/, queries/, libraries/): the strict [M+H]+ and [M-H]- subsets (447,956 source rows) re-split 70/15/15 at the level of RDKit canonical isomeric SMILES, separately per polarity, with frozen queries and libraries for spectrum-to-spectrum library search. Molecule-disjoint within each polarity. Test tasks: 6,202 positive and 3,193 negative queries against 295,434 and 137,000 library spectra.

1. Panel mapping

figure panel split evaluation population / task
Figure 2b — ionization-polarity recognition A polarity prediction over the split-A evaluation population (A test fold; A train / validation used for fitting and reference).
Figure 2j — peak-token embedding chemical atlas A peak-token embedding visualization/analysis over the split-A test fold with split-A reference spectra; colours are chemical properties, not a model output.
Figure 3a — single-spectrum candidate ranking (Hit@1/5/20) A 57,437 split-A test spectra as queries, ranked against the per-formula candidate tables used by the manuscript (candidate ranking tables are part of the UltraMS repository, not of this split package).
Figure 3b — score/rank density and cumulative Top-k A same 57,437 split-A test queries and their candidate rankings.
Figure 3d — multiple-spectrum voting A 57,437 split-A test spectra grouped into the official voting units: 5,002 MSnLib source-SMILES groups covering 57,436 spectra (split_A_full_msnlib/test_molecules_voting.csv); the alternative canonical-isomeric-SMILES view (4,888 groups, same 57,436 spectra) is split_A_full_msnlib/test_molecules_voting_canonical_view.csv; the retention times used by this analysis are split_A_full_msnlib/msnlib_rt.csv.gz (row_index, rt). See the parent README.md §4.3/§4.5.
Figure 3g — empirical rank CDF A 57,437 split-A test queries.
Figure 3a_sp_4 — label-blind consensus grouping A split-A test fold, label-blind grouping of same-molecule spectra.
Figure 3a_sp_5 — promoted MSnLib fingerprint analysis A split-A fingerprint-prediction evaluation population (split-A train / validation for fitting).
baselines — single-spectrum Top-1 table A 57,437 split-A test queries, one ranking per method.
Figure 3e — strict-adduct library search, FDR–recall B strict [M+H]+: 6,202 test queries vs 295,434 library spectra (recall denominator 6,201); strict [M-H]-: 3,193 vs 137,000 (denominator 3,160). Validation tasks: 6,202 / 250,424 and 3,193 / 116,135.
Figure 3f — cross-polarity molecular retrieval B molecule-level split-B compounds; one polarity's spectra query the other polarity's library.
Figure 3h — seven-method strict-adduct FDR–recall (unused figure) B same split-B query / library sets as Figure 3e.
Figure 3h_sp_1 — FDR threshold transfer B split-B validation/test query identities; 200 paired molecule-disjoint calibration/held-out assignments over those identities.
cross-collision-energy search B split-B test queries that have at least two collision energies: 6,161 positive and 2,999 negative cross-CE queries (from 6,202 / 3,193 split-B test queries).
NPLIB1 and MassSpecGym comparison panels not this dataset NPLIB1 (3,699 test molecules) and MassSpecGym are independent external benchmarks with their own splits and libraries; they are not derived from MSnLib and are not covered by this package.
Figure 3c / Figure 3i case studies neither case-study panels use specific MSnLib spectra and MAGMa peak annotations; they are not defined by either split table.

2. Cross-split inconsistency: split A (formulas) vs split B (compounds)

The two splits are built on different units (formula vs canonical molecule) and different populations (all adducts vs strict [M+H]+/[M-H]-), so their fold labels disagree for a large share of compounds. The tables below are computed by mapping every split-B compound to its molecular formula through msnlib_csv_data_row → split_A_full_msnlib/row_formula_fold.csv. Compound counts are split-B compounds (a compound belongs to one polarity and one split-B fold).

[M+H]+ — 41,348 compounds

split B ↓ / split A → train validation test total
train 23,059 2,901 2,984 28,944
validation 4,924 647 631 6,202
test 4,922 626 654 6,202
total 32,905 4,174 4,269 41,348

Same-fold compounds: 24,360 / 41,348 (58.9 %). Of the 6,202 split-B positive test compounds only 654 (10.5 %) are split-A test compounds; 4,922 (79.4 %) are split-A train compounds.

[M-H]- — 21,293 compounds

split B ↓ / split A → train validation test total
train 12,035 1,447 1,425 14,907
validation 2,552 307 334 3,193
test 2,541 349 303 3,193
total 17,128 2,103 2,062 21,293

Same-fold compounds: 12,645 / 21,293 (59.4 %). Of the 3,193 split-B negative test compounds only 303 (9.5 %) are split-A test compounds.

Spectra-level view

The split-B tables cover all 441,829 preprocessed strict-adduct spectra (301,636 positive + 140,193 negative); each maps to exactly one split-A fold:

[M+H]+ — 301,636 preprocessed spectra:

split B ↓ / split A → train validation test total
train 168,804 20,917 22,024 211,745
validation 35,535 4,604 4,742 44,881
test 35,716 4,490 4,804 45,010
total 240,055 30,011 31,570 301,636

[M-H]- — 140,193 preprocessed spectra:

split B ↓ / split A → train validation test total
train 79,644 9,523 9,234 98,401
validation 16,760 1,981 2,186 20,927
test 16,609 2,263 1,993 20,865
total 113,013 13,767 13,413 140,193

The spectra-level matrix is computed from the frozen protocol/ row metadata (each preprocessed row → its compound → its split-B fold) and split_A_full_msnlib/row_formula_fold.csv; the per-split totals equal the split-B split_spectra_counts of the frozen manifest (211,745 / 44,881 / 45,010 positive and 98,401 / 20,927 / 20,865 negative).

(Recompute with rebuild/verify_release.py, which rebuilds both matrices from the shipped tables.)

Relation of the split-A test fold to split B

  • 57,437 split-A test spectra in total;
  • 31,570 (55.0 %) are strict [M+H]+ spectra of the split-B tables, 13,413 (23.3 %) are strict [M-H]- spectra; 44,983 (78.3 %) therefore lie inside split B;
  • the remaining 12,454 split-A test spectra carry other adducts ([M+FA]-, [M+Cl]-, [M+Na]+, [M+NH4]+, [M+H-H2O]+, …) and never occur in split B.

What this means — and what must not be claimed

  • Split A is formula-disjoint only; split B is compound-disjoint within each polarity. Each property holds only inside its own split.
  • The two splits cannot be merged into a global-disjointness claim: about 41 % of the split-B compounds are in a different split-A fold, and the same spectrum can be a test spectrum in split A while belonging to a train compound in split B (e.g. 4,922 of the 6,202 positive split-B test compounds are split-A train compounds).
  • A score computed on an split-A test spectrum whose compound is split-B train must not be reported as a "held-out molecule" result, and vice versa. Train and evaluate within one split only; if a cross-split experiment is unavoidable, state explicitly which split defines the training population and which defines the test population.