Skip to main content

Mass spectrometry machine learning utilities derived from ProXAI notebooks.

Project description

ProXAI-MS Logo

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxai_ms-0.1.3.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proxai_ms-0.1.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

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

Hashes for proxai_ms-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2fb851ae7f004e0e27f9845731d688e1e93e78dec743d418e93c3bb7013bf784
MD5 a97b00af061e916a1e2cb51e95379dba
BLAKE2b-256 d1751784c026eae9741d35623e137f5dfde0b23b182fd0b0f5199367b4e450dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for proxai_ms-0.1.3.tar.gz:

Publisher: publish.yml on benjaminnigjeh/proxai-ms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for proxai_ms-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2677cd4fb63bb315cd545bc95bb9411582c870dbae42fa333859e37d70aa9412
MD5 accec49edd2d52cbcf36fed509b91488
BLAKE2b-256 d0034e2a796a16255f72f1ca897e48cfaaa1a0f8503b2b525ff54b7d518cb427

See more details on using hashes here.

Provenance

The following attestation bundles were made for proxai_ms-0.1.3-py3-none-any.whl:

Publisher: publish.yml on benjaminnigjeh/proxai-ms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page