Sovereign 8s.is mirror of standardgalactic/ProFormer
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-23 16:10:39 +02:00
analyze Add tune and shap files 2024-12-18 10:33:35 +01:00
config Update path in wanted_conf.yaml 2026-07-22 10:23:58 +02:00
demo Add demo files 2025-01-07 17:17:17 +01:00
src Update Proformer.py with unused method 2026-07-23 16:10:39 +02:00
train Add files via upload 2024-12-13 15:12:56 +01:00
tune Add tune and shap files 2024-12-18 10:33:35 +01:00
CITATION.cff Add citation 2026-07-22 10:40:28 +02:00
environment.yml Add files via upload 2024-12-13 15:12:56 +01:00
LICENSE Add License 2025-01-07 16:34:16 +01:00
README.md Update README.md 2026-07-22 10:31:41 +02:00
requirements.txt Add files via upload 2024-12-13 15:12:56 +01:00

ProFormer

ProFormer is a deep learning-based pipeline for proteomic data analysis, designed to classify samples based on biological or clinical status using mass spectrometric (MS) data. By leveraging the full spectrum of proteomic dimensions — retention time, mass-to-charge ratio, intensity, and ion mobility — ProFormer offers a robust approach to predict the sample class.


Features

  • Multi-dimensional data integration: Utilizes retention time, mass-to-charge ratio, intensity, and ion mobility for comprehensive analysis.
  • Flexible model configurations: Supports both transformer-based tabular model and image-based models from the PyTorch Image Models (timm) library.
    • The image-based approach can handle up to 3 dimensions of data, such as mass-to-charge ratio, retention time, and intensity.
    • The tabular transformer is highly flexible and can accommodate any number of dimensions, as it processes data in a tabular format.
  • Customizable pipeline: Allows users to fine-tune hyperparameters, data paths, and training configurations via a configuration file.
  • Seamless training and validation: Streamlined process for training and evaluating models on proteomic datasets.

Installation

The installation and verification process can be done in a few minutes with the following steps:

  1. Clone this repository:

    git clone https://github.com/DBO-DKFZ/ProFormer.git
    cd ProFormer
    
  2. Install dependencies:

You can set up the environment using Conda (recommended):

conda env create -f environment.yml
conda activate pro

Alternatively:

pip install -r requirements.txt

Demo: Running with Simulated Data

This project includes simulated (dummy) data to facilitate quick testing and demonstration of the model's training and evaluation process.

To run the demo, execute the following command from the project root (Approximately 1 minute on an average GPU):

python -m train

A log file will be generated in the project directory after execution, along with the expected output (metrics of your test data) on the console:

───────────────────────────────────────────────
      val/acc                    0.5
     val/auroc                   1.0
     val/loss             0.620395302772522
    val/recall                   0.0
──────────────────────────────────────────────


Data Preparation

When using your own data, the following structure of the data and configuration must be followed to utilize the pipeline.

Input Data

The pipeline requires the following:

  • Pickle files for each dataset (train, validate, and test), containing:
    • A .csv table with sample names under the runs column and their corresponding labels under the label column.
  • Sample feature tables in .csv format, containing the desired proteomic dimensions for each sample.

Configuration File

A configuration file is used to define all model and data parameters, including:

  • Hyperparameters
  • File paths
  • Training configurations

Refer to the wanted_conf.yaml example file for guidance.


Training the Model

To train a model:

  1. Adjust the configuration file (wanted_conf.yaml) to match your dataset and model preferences.

  2. Run the training script:

    python -m train
    

The scripts will:

  • Load data and labels from the specified pickle files.
  • Initialize the selected model (tabular transformer or a image-based model).
  • Train and validate the model using the defined configurations.

Tuning the Model

To tune a model:

  1. Adjust configuration in tuning.py to match your setup and wanted hyperparameter space.

  2. Run the tuning script:

    python -m tune.tune
    

The scripts will:

  • Load data and labels from the specified pickle files.
  • Initialize the selected model (tabular transformer or a image-based model).
  • Tune the model in given hyperparameter space with a Bayesian optimization algorithm.

Outputs

Upon completion of training, the following outputs will be generated:

  • Performance metrics: Including accuracy, precision, recall, and loss curves.
  • Logs: Training and validation logs stored for reproducibility and debugging.
  • Trained model weights: Saved in the logs file.

Requirements

Dependencies listed in requirements.txt and tested on a linux-64 device.


License

This project is licensed under the MIT License - see the LICENSE file for details.