msfiddle 2.2.1__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {msfiddle-2.2.1 → msfiddle-2.4.0}/PKG-INFO +18 -10
- {msfiddle-2.2.1 → msfiddle-2.4.0}/README.md +15 -7
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/__init__.py +2 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/api.py +485 -125
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/config/fiddle_tcn_casmi.yml +11 -10
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/config/fiddle_tcn_demo.yml +12 -10
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/config/fiddle_tcn_demo_wo_da.yml +12 -10
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/config/fiddle_tcn_embl.yml +29 -22
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/config/fiddle_tcn_orbitrap.yml +18 -19
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/config/fiddle_tcn_qtof.yml +24 -26
- msfiddle-2.4.0/msfiddle/config/fiddle_tcn_timstof.yml +142 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/dataset.py +13 -5
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/demo/input_msms.mgf +21 -21
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/download.py +59 -81
- msfiddle-2.4.0/msfiddle/evaluate.py +378 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/external_results.py +42 -6
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/main.py +98 -10
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/model_tcn.py +17 -0
- msfiddle-2.4.0/msfiddle/settings.py +75 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/utils/__init__.py +6 -0
- msfiddle-2.4.0/msfiddle/utils/casmi2026.py +231 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/utils/mol_utils.py +0 -23
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/utils/msms_utils.py +220 -74
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/utils/pkl_utils.py +59 -48
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/utils/refine_utils.py +1 -49
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle.egg-info/PKG-INFO +18 -10
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle.egg-info/SOURCES.txt +7 -1
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle.egg-info/requires.txt +2 -2
- {msfiddle-2.2.1 → msfiddle-2.4.0}/setup.py +3 -3
- {msfiddle-2.2.1 → msfiddle-2.4.0}/tests/test_api.py +122 -1
- msfiddle-2.4.0/tests/test_casmi2026.py +305 -0
- msfiddle-2.4.0/tests/test_config.py +35 -0
- msfiddle-2.4.0/tests/test_download.py +93 -0
- msfiddle-2.4.0/tests/test_evaluate.py +185 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/tests/test_external_results.py +46 -0
- msfiddle-2.4.0/tests/test_main.py +79 -0
- msfiddle-2.4.0/tests/test_msms_utils.py +208 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/tests/test_pkl_utils.py +22 -1
- msfiddle-2.4.0/tests/test_validate.py +154 -0
- msfiddle-2.2.1/msfiddle/evaluate.py +0 -152
- msfiddle-2.2.1/tests/test_download.py +0 -27
- msfiddle-2.2.1/tests/test_evaluate.py +0 -62
- msfiddle-2.2.1/tests/test_main.py +0 -43
- msfiddle-2.2.1/tests/test_msms_utils.py +0 -53
- {msfiddle-2.2.1 → msfiddle-2.4.0}/LICENSE +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/__main__.py +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/demo/output_buddy.csv +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/demo/output_fiddle.csv +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/demo/output_fiddle_all.csv +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/demo/output_sirius.csv +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle/optim.py +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle.egg-info/dependency_links.txt +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle.egg-info/entry_points.txt +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/msfiddle.egg-info/top_level.txt +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/setup.cfg +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/tests/test_mol_utils.py +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/tests/test_muon.py +0 -0
- {msfiddle-2.2.1 → msfiddle-2.4.0}/tests/test_refine_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: msfiddle
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: A package for predicting chemical formulas from tandem mass spectra
|
|
5
5
|
Home-page: https://github.com/JosieHong/FIDDLE
|
|
6
6
|
Author: Yuhui Hong
|
|
@@ -15,14 +15,14 @@ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
|
15
15
|
Requires-Python: >=3.8
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: numpy>=1.20.0
|
|
19
19
|
Requires-Dist: pandas>=2.0.0
|
|
20
20
|
Requires-Dist: tqdm>=4.60.0
|
|
21
21
|
Requires-Dist: pyyaml>=6.0
|
|
22
22
|
Requires-Dist: scikit-learn>=1.0.0
|
|
23
23
|
Requires-Dist: scipy>=1.8.0
|
|
24
24
|
Requires-Dist: pyarrow>=10.0.0
|
|
25
|
-
Requires-Dist: rdkit
|
|
25
|
+
Requires-Dist: rdkit!=2026.9.2,>=2022.03.5
|
|
26
26
|
Requires-Dist: molmass
|
|
27
27
|
Requires-Dist: pyteomics
|
|
28
28
|
Provides-Extra: inference
|
|
@@ -69,11 +69,13 @@ msfiddle predict --demo --result_path demo.csv # 21 bundled example spect
|
|
|
69
69
|
msfiddle predict --test_data spectra.mgf --instrument_type orbitrap --result_path results.csv
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
The `inference` extra installs PyTorch. For a particular PyTorch build (another CUDA version, CPU only), install it [from pytorch.org](https://pytorch.org/get-started/locally/) first, then `pip install msfiddle`.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Use `--instrument_type qtof` for Q-TOF data and `--instrument_type timstof` for timsTOF data. Each spectrum needs `TITLE`, `PRECURSOR_MZ`, `PRECURSOR_TYPE` and `COLLISION_ENERGY`. The results list ranked candidates per spectrum in `Refined Formula (0)`, `Refined Formula (1)`, … with their scores in `Rescore (k)`.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
When the true formulas are known (a `SMILES` or `FORMULA` field in each spectrum), add `--eval` to also report top-k accuracy, saved as `results_eval.csv`. `msfiddle validate --test_data your.mgf` checks a file without the models and says why any spectrum would be skipped; if accuracy is lower than expected, see [troubleshooting](https://msfiddle.readthedocs.io/en/latest/troubleshooting.html).
|
|
77
|
+
|
|
78
|
+
The [documentation](https://msfiddle.readthedocs.io) covers the Python API, BUDDY and SIRIUS integration, custom checkpoints, all output columns, and [benchmark results](https://msfiddle.readthedocs.io/en/latest/benchmarks.html).
|
|
77
79
|
|
|
78
80
|
## Reproduce the paper
|
|
79
81
|
|
|
@@ -85,7 +87,12 @@ This repository also holds the research code for training and evaluation. Run ev
|
|
|
85
87
|
conda env create -f environment.yml
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
2. (optional) Install [BUDDY](https://github.com/Philipbear/msbuddy) and [SIRIUS](https://v6.docs.sirius-ms.io/) for the comparison experiments.
|
|
90
|
+
2. (optional) Install [BUDDY](https://github.com/Philipbear/msbuddy) and [SIRIUS](https://v6.docs.sirius-ms.io/) for the comparison experiments. SIRIUS needs a free account; log in once as `install_sirius.sh` prints at the end.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
bash running_scripts/install_buddy.sh
|
|
94
|
+
bash running_scripts/install_sirius.sh
|
|
95
|
+
```
|
|
89
96
|
|
|
90
97
|
3. Download the models into `./check_point/`, where the scripts expect them:
|
|
91
98
|
|
|
@@ -95,15 +102,16 @@ msfiddle download -d ./check_point
|
|
|
95
102
|
|
|
96
103
|
| Script | Description |
|
|
97
104
|
|---|---|
|
|
98
|
-
| `running_scripts/train_release_v2.
|
|
105
|
+
| `running_scripts/train_release_v2.4.sh` | As `train_release_v2.3.sh`, but as in the paper the theoretical precursor m/z of NIST20 and NIST23 is replaced by the theoretical m/z plus a seeded Gaussian error within the instrument's tolerance; trains one instrument after another on two GPUs |
|
|
106
|
+
| `running_scripts/train_release_v2.3.sh` | Build the data, train the release models (TCN and rescore) for Q-TOF, Orbitrap and timsTOF in parallel and evaluate them; `INSTRUMENTS=timstof` runs one of them. timsTOF trains on the Enveda CASMI 2026 library at `data/origin/casmi2026/train.parquet` |
|
|
99
107
|
| `running_scripts/experiments_test_benchmark.sh` | Evaluate on external benchmarks (CASMI 2016, CASMI 2017, EMBL-MCF 2.0) |
|
|
100
108
|
| `running_scripts/experiments_test_nist23.sh` | Train and evaluate with compounds new in NIST23 held out |
|
|
101
109
|
| `running_scripts/experiments_test_chimeric.sh` | Evaluate on chimeric spectra |
|
|
102
110
|
| `running_scripts/experiments_test_noised.sh` | Evaluate on spectra with added noise peaks |
|
|
103
111
|
|
|
104
|
-
The benchmark, chimeric and noise experiments use the released models; the chimeric and noise ones also need the data
|
|
112
|
+
The benchmark, chimeric and noise experiments use the released models; the chimeric and noise ones also need the data those models were trained on.
|
|
105
113
|
|
|
106
|
-
To train from scratch, see `scripts/
|
|
114
|
+
To train from scratch, see `scripts/train_tcn_gpus_cl.py` and `scripts/train_rescore.py` with the configs in [`msfiddle/config/`](https://github.com/JosieHong/FIDDLE/tree/main/msfiddle/config).
|
|
107
115
|
|
|
108
116
|
## Citation
|
|
109
117
|
|
|
@@ -28,11 +28,13 @@ msfiddle predict --demo --result_path demo.csv # 21 bundled example spect
|
|
|
28
28
|
msfiddle predict --test_data spectra.mgf --instrument_type orbitrap --result_path results.csv
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
The `inference` extra installs PyTorch. For a particular PyTorch build (another CUDA version, CPU only), install it [from pytorch.org](https://pytorch.org/get-started/locally/) first, then `pip install msfiddle`.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Use `--instrument_type qtof` for Q-TOF data and `--instrument_type timstof` for timsTOF data. Each spectrum needs `TITLE`, `PRECURSOR_MZ`, `PRECURSOR_TYPE` and `COLLISION_ENERGY`. The results list ranked candidates per spectrum in `Refined Formula (0)`, `Refined Formula (1)`, … with their scores in `Rescore (k)`.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
When the true formulas are known (a `SMILES` or `FORMULA` field in each spectrum), add `--eval` to also report top-k accuracy, saved as `results_eval.csv`. `msfiddle validate --test_data your.mgf` checks a file without the models and says why any spectrum would be skipped; if accuracy is lower than expected, see [troubleshooting](https://msfiddle.readthedocs.io/en/latest/troubleshooting.html).
|
|
36
|
+
|
|
37
|
+
The [documentation](https://msfiddle.readthedocs.io) covers the Python API, BUDDY and SIRIUS integration, custom checkpoints, all output columns, and [benchmark results](https://msfiddle.readthedocs.io/en/latest/benchmarks.html).
|
|
36
38
|
|
|
37
39
|
## Reproduce the paper
|
|
38
40
|
|
|
@@ -44,7 +46,12 @@ This repository also holds the research code for training and evaluation. Run ev
|
|
|
44
46
|
conda env create -f environment.yml
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
2. (optional) Install [BUDDY](https://github.com/Philipbear/msbuddy) and [SIRIUS](https://v6.docs.sirius-ms.io/) for the comparison experiments.
|
|
49
|
+
2. (optional) Install [BUDDY](https://github.com/Philipbear/msbuddy) and [SIRIUS](https://v6.docs.sirius-ms.io/) for the comparison experiments. SIRIUS needs a free account; log in once as `install_sirius.sh` prints at the end.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bash running_scripts/install_buddy.sh
|
|
53
|
+
bash running_scripts/install_sirius.sh
|
|
54
|
+
```
|
|
48
55
|
|
|
49
56
|
3. Download the models into `./check_point/`, where the scripts expect them:
|
|
50
57
|
|
|
@@ -54,15 +61,16 @@ msfiddle download -d ./check_point
|
|
|
54
61
|
|
|
55
62
|
| Script | Description |
|
|
56
63
|
|---|---|
|
|
57
|
-
| `running_scripts/train_release_v2.
|
|
64
|
+
| `running_scripts/train_release_v2.4.sh` | As `train_release_v2.3.sh`, but as in the paper the theoretical precursor m/z of NIST20 and NIST23 is replaced by the theoretical m/z plus a seeded Gaussian error within the instrument's tolerance; trains one instrument after another on two GPUs |
|
|
65
|
+
| `running_scripts/train_release_v2.3.sh` | Build the data, train the release models (TCN and rescore) for Q-TOF, Orbitrap and timsTOF in parallel and evaluate them; `INSTRUMENTS=timstof` runs one of them. timsTOF trains on the Enveda CASMI 2026 library at `data/origin/casmi2026/train.parquet` |
|
|
58
66
|
| `running_scripts/experiments_test_benchmark.sh` | Evaluate on external benchmarks (CASMI 2016, CASMI 2017, EMBL-MCF 2.0) |
|
|
59
67
|
| `running_scripts/experiments_test_nist23.sh` | Train and evaluate with compounds new in NIST23 held out |
|
|
60
68
|
| `running_scripts/experiments_test_chimeric.sh` | Evaluate on chimeric spectra |
|
|
61
69
|
| `running_scripts/experiments_test_noised.sh` | Evaluate on spectra with added noise peaks |
|
|
62
70
|
|
|
63
|
-
The benchmark, chimeric and noise experiments use the released models; the chimeric and noise ones also need the data
|
|
71
|
+
The benchmark, chimeric and noise experiments use the released models; the chimeric and noise ones also need the data those models were trained on.
|
|
64
72
|
|
|
65
|
-
To train from scratch, see `scripts/
|
|
73
|
+
To train from scratch, see `scripts/train_tcn_gpus_cl.py` and `scripts/train_rescore.py` with the configs in [`msfiddle/config/`](https://github.com/JosieHong/FIDDLE/tree/main/msfiddle/config).
|
|
66
74
|
|
|
67
75
|
## Citation
|
|
68
76
|
|
|
@@ -14,6 +14,7 @@ from .api import (
|
|
|
14
14
|
predict_batch_from_spectra,
|
|
15
15
|
predict_from_mgf,
|
|
16
16
|
predict_from_spectrum,
|
|
17
|
+
validate_mgf,
|
|
17
18
|
)
|
|
18
19
|
from .utils.mol_utils import vector_to_formula, formula_to_vector
|
|
19
20
|
from .utils.msms_utils import mass_calculator
|
|
@@ -39,6 +40,7 @@ __all__ = [
|
|
|
39
40
|
"predict_from_spectrum",
|
|
40
41
|
"predict_batch_from_spectra",
|
|
41
42
|
"predict_from_mgf",
|
|
43
|
+
"validate_mgf",
|
|
42
44
|
"MS2FNet_tcn",
|
|
43
45
|
"FormulaEncoder",
|
|
44
46
|
"RescoreHead",
|