Expression colocalization of transcripts for niche discovery.
Ecoton takes as input the spatial coordinates and gene identities of individual transcripts and outputs a gene-gene colocalization graph along with spatial niches defined directly from transcript colocalization patterns.
The workflow is as follows:
- Proximal transcripts from the same gene are clustered into metatranscripts.
- A metatranscript–metatranscript spatial proximity graph is constructed based on local distances.
- Gene pairs that colocalize more frequently than expected under a permutation-based null model are identified, yielding a gene–gene colocalization graph.
- Archetypal decomposition of this graph produces soft gene modules.
- Each archetype is mapped back to binned transcript expression in space using a linear combination of spatially normalized gene maps, giving archetype-specific niche intensity maps.
- These continuous niche intensity maps are thresholdable at progressive levels to derive binary niches.
- For downstream analyses, these transcript-level niches can optionally be intersected with cell segmentation to derive cell-level niche labels.
To install, run pip install . in this repository after cloning it.
Refer to scripts/ecoton_quick_start_tutorial_lymph.ipynb for a tutorial on using Ecoton for a public Xenium 5K human lymph node dataset.
Ecoton can also be run directly from a command-line workflow. The following combines all steps of Ecoton before downstream analyses.
ecoton \
--transcripts-path ../spatial_5k/data/transcripts.parquet \
--transcripts-format parquet \
--output-dir processed_data(can also run as module instead, using python -m ecoton)
--mode(default:xenium_5k)--k(default:25)--seed(default:1)--organism(default:Human)--min-points(default:3)--bin-size(default:8.0)--smoothing-radius(default:8.0)--weight-threshold(default:0.3)--save-module-plotto save selected module visualization
The workflow writes these files into --output-dir:
workflow.pklruntime_tracking.pklselected_archetypal_modules.png(when--save-module-plotis set)
