Path2Space Codebase
Authors/Creators
Description
Path2Space Codebase
Overview
This repository contains the codebase for Path2Space, a model designed for predicting spatial transcriptomics (ST) from Hematoxylin and Eosin (H&E) stained slides.
Included Content
This repository includes:
- `scripts/` : a repository containing all necessary source code
- `tutorials/` : a repository containing a detailed tutorial to run Path2Space on a small example dataset
- `input_data/` : a repository containing the necessary inputs to run the tutorial
- `docs/` : a repository with an installation guide for all the required dependencies
System Requirements
Software Dependencies:
The software requires Python (3.10.8) and the following libraries:
- NumPy (1.24.4)
- Pandas (2.2.2)
- scikit-learn (1.5.1)
- Matplotlib (3.7.2)
- Seaborn (0.13.2)
- OpenSlide (1.3.1; for TGGA slides)
- OpenCV (4.6.0)
- Pillow (9.2.0; for ST slides)
- PyTorch (2.4.0+cu121)
Operating Systems Tested On:
- Linux 4.18.0-425.19.2.el8_7.x86_64
Hardware Requirements:
No special hardware is required; the code runs on a standard desktop computer. For large datasets, a GPU is recommended for faster processing.The code was tested on a system with the following specifcations
- Processor: x86_64
- CPU Cores: 28 (Physical), 56 (Logical)
- Total RAM: 251.50 GB
- GPU: Tesla K802. Installation Guide
Installation Instructions:
Follow instructions in `docs/INSTALLATION_GUIDE.md`
Estimated Installation Time:
Typically, it takes about 10–15 minutes on a standard desktop computer.
Demo
Instructions to Run Demo:
1. Navigate to the `tutorials/` folder.
2. Use the provided sample dataset and the provided tutorials to test the feature extraction, regression, and prediction pipelines.
- 1.STprediction_example.ipynb
- 2.CellTypeModel_example.ipynb
- 3.SPAND_example.ipynb
Expected Output:
- Example outputs and prediction results are stored in the `output_data/` folder.
Instructions for Use
Running on Your Data:
1. Prepare your data following the format provided in the demo dataset (`input_data/` folder).
2. Run the relevant scripts as described in the Usage section below.
Reproduction Instructions:
To reproduce all quantitative results described in the manuscript:
1. Use the full dataset specified in the Data Avalaibility section of the manuscript.
2. Follow the same pipeline steps as outlined above.
Usage
1.1. Feature Extraction:
- Navigate to `1.ST_prediction/1.1.Feature_extraction`.
- Run `1main_feature_extraction.py` for extracting features from H&E slide images.
1.2. Regression Tasks:
- Navigate to `1.ST_prediction/1.2.Regression`.
- Use `1main_regression.py` to train a regression model for ST prediction from H&E image features (output of 1.1).
1.3. Prediction Tasks:
- Navigate to `1.ST_prediction/1.3.Prediction`.
- Use `Prediction.py` to predict ST from features (output of 1.1) on a new dataset using a previously trained model (output of 1.2).
2.1. Cell Type Fraction Model Training:
- Navigate to `2.Cell_type_fraction_model/`.
- Use `2.1.main_cell_type_model.py` to train a cell type fraction prediction model from inferred ST values (output of 1.2 or 1.3).
2.2. Cell Type Fraction Prediction:
- Navigate to `2.Cell_type_fraction_model/`.
- Use `2.2.prediction.py` to predict cell type fractions from inferred ST values (output of 1.2 or 1.3) using a trained model (output of 2.1).
3. SPAND Analysis:
- Open `SPAND/SPAND.py` to calculate SPAND for a given slide and a given gene from inferred ST values (output of 1.2 or 1.3).
License and Terms of Use
This model and its associated code have been filed for a provisional US patent (application no. 63/703,060, United States, 2024) and are permitted solely for non-commercial, academic research purposes. Commercial use, sale, or any form of monetization of the DEPLOY model is strictly prohibited without prior approval. Commercial entities interested in utilizing the model should contact the corresponding authors for authorization.
Files
docs.zip
Files
(4.1 GB)
| Name | Size | |
|---|---|---|
|
md5:ff575438d5a0b12d18f352019cccefb4
|
64.7 kB | Preview Download |
|
md5:8dea3e21f4154d5d70f444d5bb28619b
|
3.8 GB | Preview Download |
|
md5:359ef8c1ef5e72725bcea3bb68a6ed84
|
232.8 MB | Preview Download |
|
md5:6842bd847d08afeb83ca8d4d9309e024
|
3.8 kB | Preview Download |
|
md5:5a30af5ba40121aed8218f2b7e9ef105
|
362 Bytes | Preview Download |
|
md5:0ba2f5f85b16f37174673800756acaa2
|
85.2 kB | Preview Download |
|
md5:d04d94bf139f15e8921b7abdb432d5a8
|
336.8 kB | Preview Download |
Additional details
Software
- Programming language
- Python