Mass spectrometry machine learning utilities derived from ProXAI notebooks.
Project description
ProXAI-MS
Transforming MS1 Data into Learnable Representations
via Gradient-Based Pseudo-MS1 Spectra
🚀 Overview
ProXAI-MS is a machine learning framework that converts MS1 data into interpretable pseudo-MS1 spectra using gradient-based saliency mapping.
It enables:
- Binary classification (control vs experiment)
- Gradient-based feature attribution
- Reconstruction of spectra from learned signal importance
🔥 Key Features
- Train ML models on binned MS1 data
- Gradient-based explainability
- Separate positive vs negative gradients
- Convert gradients → pseudo-MS1 spectra
- Supports flexible dataset formats (long or wide)
- CLI + Python API
📦 Installation
From PyPI
pip install proxai-ms
From source
git clone https://github.com/benjaminnigjeh/proxai-ms.git
cd proxai-ms
pip install -e .
⚙️ CLI Usage
Run the full pipeline:
proxai-ms run \
--csv "F:\20251110\dataset_rt.csv" \
--label-column target \
--bin-column bin \
--bin-values 15 \
--control-labels 0 1 2 \
--experiment-labels 3 4 \
--out-prefix "F:\20261110\proxai_test"
### 🔹 Arguments
- --csv → Input dataset
- --label-column → Label column
- --bin-column → Column for bin grouping
- --bin-values → Number of bins per sample
- --control-labels → Control group labels
- --experiment-labels → Experiment group labels
- --out-prefix → Output prefix
---
### 📤 Outputs
- <prefix>_pseudo_ms1_positive.csv
- <prefix>_pseudo_ms1_negative.csv
- <prefix>_pseudo_ms1_plot.png
---
## 🧪 Python API
Run the full ProXAI pipeline directly in Python:
```python
from proxai_ms import run_pipeline
result = run_pipeline(
csv_path="dataset.csv",
label_column="target",
bin_column="bin",
bin_values=15,
control_labels=[0, 1, 2],
experiment_labels=[3, 4],
)
---
## 📊 Input Format
Supports:
### Wide format
Rows = samples, columns = m/z bins
### Long format
- bin column (grouping index)
- intensity values
- label column
---
## 🔬 Core Concept
ProXAI learns signal importance via gradients:
- Positive gradients → experiment signal
- Negative gradients → control signal
These are mapped back to spectral space to form:
> **Pseudo-MS1 = learned biochemical representation**
Unlike traditional pipelines:
- No peak picking required
- No manual feature engineering
- Fully data-driven representation learning
---
## 🧱 Project Structure
proxai-ms/
├── assets/
├── src/proxai_ms/
│ ├── training.py
│ ├── explain.py
│ ├── pipeline.py
│ └── cli.py
├── notebooks/
├── docs/
├── scripts/
└── pyproject.toml
---
## ⚠️ Important Notes
- Disable normalization if gradients collapse to zero
- Avoid averaging gradients across samples incorrectly
- Always separate positive and negative gradients before aggregation
---
## 🛣️ Roadmap
- Deep learning models (CNN / Transformer)
- Multi-class classification
- UniDec integration
- mzML export
- GUI (ProXAI Desktop)
---
## 👨🔬 Author
Benjamin Nouri Nigjeh
Proteomics • Machine Learning • Mass Spectrometry
---
## 📜 License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proxai_ms-0.1.3.tar.gz.
File metadata
- Download URL: proxai_ms-0.1.3.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fb851ae7f004e0e27f9845731d688e1e93e78dec743d418e93c3bb7013bf784
|
|
| MD5 |
a97b00af061e916a1e2cb51e95379dba
|
|
| BLAKE2b-256 |
d1751784c026eae9741d35623e137f5dfde0b23b182fd0b0f5199367b4e450dc
|
Provenance
The following attestation bundles were made for proxai_ms-0.1.3.tar.gz:
Publisher:
publish.yml on benjaminnigjeh/proxai-ms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proxai_ms-0.1.3.tar.gz -
Subject digest:
2fb851ae7f004e0e27f9845731d688e1e93e78dec743d418e93c3bb7013bf784 - Sigstore transparency entry: 1178157052
- Sigstore integration time:
-
Permalink:
benjaminnigjeh/proxai-ms@6b2a976c2c279e5a9c5649842015c916ba6cbcd1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/benjaminnigjeh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6b2a976c2c279e5a9c5649842015c916ba6cbcd1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file proxai_ms-0.1.3-py3-none-any.whl.
File metadata
- Download URL: proxai_ms-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2677cd4fb63bb315cd545bc95bb9411582c870dbae42fa333859e37d70aa9412
|
|
| MD5 |
accec49edd2d52cbcf36fed509b91488
|
|
| BLAKE2b-256 |
d0034e2a796a16255f72f1ca897e48cfaaa1a0f8503b2b525ff54b7d518cb427
|
Provenance
The following attestation bundles were made for proxai_ms-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on benjaminnigjeh/proxai-ms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proxai_ms-0.1.3-py3-none-any.whl -
Subject digest:
2677cd4fb63bb315cd545bc95bb9411582c870dbae42fa333859e37d70aa9412 - Sigstore transparency entry: 1178157150
- Sigstore integration time:
-
Permalink:
benjaminnigjeh/proxai-ms@6b2a976c2c279e5a9c5649842015c916ba6cbcd1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/benjaminnigjeh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6b2a976c2c279e5a9c5649842015c916ba6cbcd1 -
Trigger Event:
release
-
Statement type: