Spatial self-supervised Peak Learning and correlation-based Evaluation of peak picking in Mass Spectrometry Imaging
S3PL is a spatial self-supervised peak learning autoencoder network which performs spatially structured peak picking on profile mass spectrometry imaging (MSI) data. This repository contains the source code for the corresponding paper:
Philipp Weigand, Nikolas Ebert, Shad A. Mohammed, Denis Abu Sammour, Carsten Hopf & Oliver Wasenmüller
CeMOS - Research and Transfer Center, University of Applied Sciences Mannheim
We recommend using Docker for a clean setup. Alternatively, setup a local environment.
-
Clone our repository using git
git clone https://github.com/CeMOS-IS/S3PL.git cd S3PL/
-
Build the Docker image by using the following command in the terminal of this projects folder:
docker build -t s3pl .
-
Run the Docker container:
docker run -it --rm --gpus '"device=0"' -v .:/workspace s3pl or docker run -it --rm -v /path/to/S3PL:/workspace s3pl (If you are not in the S3PL directory)
Depending on your GPU you might have to change the base image in the first line of the Dockerfile.
-
Clone our repository using git
git clone https://github.com/CeMOS-IS/S3PL.git
-
Setup a virtual environment for example with Anaconda
conda create --name s3pl python=3.11.5 conda activate s3pl
-
Install the required python packages:
pip install -r requirements.txt
At first use, create the data/
folder within the s3pl/
folder. For every dataset, create a new folder in the data/
folder. The dataset folder should contain the .imzML
files and the corresponding .ibd
files. If there are segmentation masks available, create a masks/
folder and put the corresponding segmentation masks in there (filename_mask.npy
).
The folder structure should be as follows:
s3pl
├── data
├── dataset1
│ ├── masks
│ │ ├── file1_mask.npy
│ │ ├── file2_mask.npy
│ │ └── ...
│ ├── file1.imzML
│ ├── file1.ibd
│ ├── file2.imzML
│ ├── file2.ibd
│ └── ...
├── dataset2
│ ├── masks
│ │ ├── file3_mask.npy
│ │ ├── file3_mask.npy
│ │ └── ...
│ ├── file3.imzML
│ ├── file3.ibd
│ └── ...
└── ...
The selected tissue sections from the CAC dataset are available here.
To use S3PL for peak picking, specify the .imzML
file as the data_dir
in the s3pl/config.json
file.
Then, run the s3pl/main.py
file:
python s3pl/main.py
The resulting peak list will be stored in a .csv
file in the folder
results/<name_of_the_training>/peak_evaluation_<filename>.txt
Available configurations in config.json:
data_dir
: relative path to .imzML file,number_classes
: the number of classes in the segmentation mask (e.g. 3 classes: background, tumor, healthy tissue),evaluate_peak_picking
: whether peak picking should be evaluated using our correlation-based procedure (segmentation masks are required for this),number_peaks
: the number of peaks to be picked,peaks_per_spectral_patch
: the number of peaks z per spectral,spectral_patch_size
: size of the spectral patch p,kernel_depth_d1
: depth d1 of the 3D convolution,kernel_depth_d2
: depth d2 of the 3D transposed convolution
The number of peaks to be picked can be specified by the parameter number_peaks
in the s3pl/config.json
file. In order to save the number of peaks for different filenames, extend the entries in the s3pl/data_configs.py
file. If these entries should be used, just assign null
to number_peaks
. The same applies for the number_classes
.
Email: p.weigand@doktoranden.hs-mannheim.de
If you use this code in your research, please cite our paper:
@article{,
title={},
author={},
journal={},
volume={},
number={},
pages={},
year={},
publisher={}
}