DISSECT: Diffusion-based Cell Segmentation Integrating Spatial Transcriptomics
DISSECT (DIffusion-based cell Segmentation integrating Spatially rEsolved transCripTome) is an advanced cell segmentation algorithm developed by the Zeng Lab. It combines cytological image segmentation with transcriptome-guided fine-tuning to achieve precise spatial transcriptome reconstruction.
DISSECT leverages a pre-trained deep generative model to identify cell nuclei or membrane boundaries. By unifying the gradient fields of cytological images and transcriptomics data, it refines cell boundaries and reconstructs spatial single-cell transcriptomes.
Key Features
- Integration of deep generative models for segmentation.
- Combines spatial transcriptomic data with image analysis for enhanced accuracy.
- Supports transcriptomics data from multiple platforms:
- 10X Xenium
- BGI Stereo-seq
- Nanostring CosMx
- Outputs include refined cell masks, bounding boxes, and spatial transcriptomes for downstream analyses.
Dependencies
Below are the essential libraries required to use DISSECT:
- Python Packages:
numpypandastorchtqdmscipyskimageshapelydetectron2joblib
For full dependencies, refer to the environment.yml file.
Installation
Currently, DISSECT supports the following installation methods:
- Pypi: Coming soon.
- Conda: Coming soon.
Input Requirements
To use DISSECT, you need:
-
Aligned Cytological Images:
- Supported formats:
.tif,.tiff,.png,.jpg. - Images should be pre-registered with spatial transcriptomics data.
- Recommended libraries for loading images:
tifffile,cv2, orskimage.
- Supported formats:
-
Transcriptomics Data:
- For platforms like 10X Xenium, BGI Stereo-seq, or Nanostring CosMx, provide the native gene matrix file.
- For other platforms, prepare a
.csvor.tsvfile with the following four columns:x: The x-coordinate of the transcript.y: The y-coordinate of the transcript.geneID: The name or identifier of the transcript.MIDCount: The number of transcripts at the given location (usually1for imaging-based technologies).
Usage Example
import DISSECT
mask = DISSECT.segmentation(
img_path="example_stereseq.tif",
platform="stereoseq",
gene_mtx_filename="example_stereoseq.gem",
config_file="config.yaml",
weights_file="model_weights.pth"
)
Parameters:
img_path: Path to the cytological image file.gene_mtx_filename: Path to the gene matrix file in.csv,.tsv, or.gemformat.platform: The sequencing platform, options include:"xenium""stereoseq""nanostring"
config_file: Path to an optional YAML file for model configuration parameters.weights_file: Path to the pre-trained model weights file (download available https://drive.google.com/file/d/1Y9_YCJzhUPEQBDAdKVyrKplI1vpD4qiO/view?usp=sharing).
Optional Parameters:
output: Path to store the .npy file of segmented mask and detected bounding boxes. Default: Current working directory.alpha(float): Sets the weight of the transcriptomic gradient field in refining cell boundaries. Default:0.5.expand_by(int): Number of pixels by which the bounding box is expanded outward. This ensures accurate cell boundaries without enlarging the actual cell size. Default:5.gene(bool): Whether to use transcriptomics data for fine-tuning. Default:True.random_seed(int): Seed for random number generation to ensure reproducibility. Default: No predefined seed.num_proposals(int): Number of bounding boxes proposed by the diffusion model. Default:1200.isslice(bool): Whether to extract a subset of the image for training. Default:False.x0, y0(int): The x and y coordinates of the upper-left corner of the extracted region whenissliceisTrue.length, width(int): The length (x-axis) and width (y-axis) of the extracted image region whenissliceisTrue.fov(int): Field of view ID to select a specific local area in the gene expression matrix, applicable whenplatform="nanostring".
Outputs:
- Cell Masks: The model generates refined cell masks and saves them as a NumPy
.npyfile. - Bounding Boxes: Detected cell bounding boxes are saved in a
.csvfile, allowing for further custom parameter adjustments. - Spatial Transcriptomes: Outputs reconstructed spatial single-cell transcriptomes.
The output files are saved in the specified directory for downstream analysis.
Citation
If you use DISSECT in your research, please consider citing the following:
Zeng Lab
Dissection of Spatial Transcriptomics with Cytological Imaging Integration
Metadata
Release files for dissect-st 0.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dissect_st-0.5.4.tar.gz | 64.5 kB | Without provenance | Details for dissect_st-0.5.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dissect_st-0.5.4-py3-none-any.whl | Python 3 | none | any | Details for dissect_st-0.5.4-py3-none-any.whl |
Total release size: 131.8 kB
Release files / dissect_st-0.5.4.tar.gz
| Download URL | dissect_st-0.5.4.tar.gz |
|---|---|
| Size | 64.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da63d4c2645b02a948e2262f98083760e1f1ad6b7d8085dfa222e96d377a8580
|
|
BLAKE2b-256 checksum How to use checksums |
05b1f6f479fa48e2e76b7cca19a90fb985ae1c374b1c5057a660e029cbce66fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / dissect_st-0.5.4-py3-none-any.whl
| Download URL | dissect_st-0.5.4-py3-none-any.whl |
|---|---|
| Size | 67.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
125ba87834df7113f2c1e4c9702ec93c1f4b209c0d18e6d727a8c797375cb5f7
|
|
BLAKE2b-256 checksum How to use checksums |
cf45e109fe4715d983582a2cb734f89c76099bb2d8a5707fa4670596ca2c763b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for dissect-st 0.5.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.