Skip to contents

Spatial EcoTyper is a versatile framework for identifying spatially distinct multicellular communities, termed spatial ecotypes, from single-cell spatial transcriptomics data. In addition, it provides unified methods for the recovery of spatial ecotypes across multiple data modalities, including spatial transcriptomics, single-cell RNA-seq, and bulk transcriptomic datasets.

Spatial EcoTyper is available as an R package, with comprehensive documentation accessible at https://digitalcytometry.github.io/spatialecotyper, including eight tutorials illustrating the key functionalities of the framework:

Spatial EcoTyper and its companion method Liquid EcoTyper are available as a web application at https://spatialecotyper.stanford.edu/. This platform enables recovery of spatial ecotypes from single-cell RNA-seq and single-cell spatial transcriptomics data, as well as inference of spatial ecotype abundances from Visium spatial transcriptomics, bulk RNA-seq, and tumor and plasma methylation profiles.

Note: Spatial EcoTyper depends extensively on Seurat for key processes like dimensionality reduction, UMAP embedding, clustering, and visualization. Initially developed using Seurat v4.3, the tool has been thoroughly tested and validated with Seurat v5. Although UMAP embeddings and clustering results show slight differences between Seurat v4 and v5, the overall consistency remains strong, ensuring that core biological insights are preserved across both versions.

System requirements

  • R: Version 4.0 or higher is required.
  • Operating Systems: This package is compatible with all operating systems and has been tested on the following platforms:
    • macOS: Big Sur, Monterey, Ventura, Sonoma, Sequoia (15.2)
    • Linux: CentOS 7.2 and High-Performance Computing (HPC) clusters

Installation

Spatial EcoTyper is available as an R package.

Install in an existing R environment

If you already have Seurat installed, you can install Spatial EcoTyper and its dependencies directly in R:

## Install dependencies
BiocManager::install(c("remotes", "NMF", "dplyr", "tidyr", "pals", "parallel", 
                       "data.table", "spdep", "ComplexHeatmap",
                       "immunogenomics/presto"))

## Install SpatialEcoTyper
BiocManager::install("digitalcytometry/spatialecotyper")
Install in a conda environment (recommended for servers)
  • Create environment and install core dependencies

    conda create -n spatialecotyper -y
    conda activate spatialecotyper
    conda install -y -c conda-forge r-base r-seurat r-spdep r-nmf
    conda install -y -c bioconda bioconductor-complexheatmap
  • Install R packages

    if(!"BiocManager" %in% installed.packages()){
      install.packages("BiocManager")
    }
    
    ## Install dependencies
    BiocManager::install("immunogenomics/presto")
    
    ## Install SpatialEcoTyper
    BiocManager::install("digitalcytometry/spatialecotyper")
Troubleshooting dependency installation
  • ERROR: dependency ‘GetoptLong’ is not available for package ‘ComplexHeatmap’

    If the installation within R console fails, you can try installing the necessary packages via conda install or mamba install.

  • Failed to install ‘presto’ from GitHub: HTTP error 401. Bad credentials

    To resolve this issue, you’ll need to authenticate using a personal access token (PAT). You can generate a GitHub personal access token following the GitHub’s documentation. After generating the token, set it as an environment variable in R using the following code. Replace “YOUR_TOKEN” with your actual token:

    ## Set the token in your R environment:
    Sys.setenv(GITHUB_PAT="YOUR_TOKEN")
    
    ## Install the package from GitHub:
    BiocManager::install("immunogenomics/presto")
Install SpatialEcoTyper from source code

The source code of Spatial EcoTyper is available at https://github.com/digitalcytometry/spatialecotyper. After downloading the package, you can install it from the source code using the command:

install.packages("SpatialEcoTyper.tar.gz", repos = NULL)

Contribution

If you encounter any bugs or have suggestions for improvements, please feel free to open an issue or submit a pull request. Your feedback and contributions help us make the tool better for everyone.

License

Please see the LICENSE file.

Citation

If you use Spatial EcoTyper, please cite:

Wubing Zhang*, Erin L. Brown*, Abul Usmani*, Noah Earland, Minji Kang, Chibuzor Olelewe, Anushka Viswanathan, Pradeep S. Chauhan, Chloé B. Steen, Hyun Soo Jeon, Susanna Avagyan, Irfan Alahi, Nicholas P. Semenkovich, Janella C. Schwab, Chloe M. Sachs, Faridi Qaium, Peter K. Harris, Qingyuan Cai, Andrew J. Gentles, James Knight, Rondell P. Graham, Antonietta Bacchiocchi, Peter C. Lucas, Ryan C. Fields, Mario Sznol, Ruth Halaban, David Y. Chen, Aadel A. Chaudhuri and Aaron M. Newman. Non-invasive profiling of the tumour microenvironment with spatial ecotypes. Nature, 2026. doi.org/10.1038/s41586-026-10452-4.