How fish-quant/rna2seg works
Project type and purpose
• RNA2seg is a Python library/package for deep-learning based cell segmentation in image-based spatial transcriptomics.
• It provides core modules for data ingestion (Zarr datasets + spatial RNA data via SpatialData), model definition (a CI-UNet), training scripts, utilities, logging, plus Jupyter notebooks and Sphinx-based documentation.
File structure
Top level:
• src/rna2seg/ ← core library
• docs/ ← Sphinx documentation sources and build artifacts
• img/ ← logos and overview images
• test/ ← unit tests
• pyproject.toml, requirements.txt, readthedocs.yml ← packaging & CI
Inside src/rna2seg/:
• dataset_zarr/ ← classes for loading Zarr datasets, background removal, augmentation, patching, staining/RNA transforms
• ci_unet.py ← definition of the convolutional–involution UNet model
• models.py ← higher-level model wrappers or alternate architectures
• train.py ← training orchestration: hyperparameters, data pipeline, model instantiation, optimizer, callbacks
• logger.py ← experiment logging (console, file, maybe wandb/tensorboard)
• utils.py ← helper functions (I/O, transforms, etc)
• __init__.py ← package exports
README for additional insights
• Highlights multi-channel inputs (nuclear, membrane, RNA)
• Leverages SpatialData for handling spatial transcriptomics formats
• Provides zero-shot inference notebooks: apply_model_on_crops.ipynb, apply_model_on_zarr.ipynb, train_model_on_zarr.ipynb
Elements
• Blue for core logic (src/rna2seg)
• Green for data (dataset_zarr)
• Orange for model & training
• Purple for docs & notebooks
Detailed capture of essential architectural elements
• CI/CD (readthedocs build, pytest) as a side pipeline.