SPAC: A Python Package for Spatial Single-Cell Analysis of Multiplexed Imaging

SPAC: A Python Package for Spatial Single-Cell Analysis of Multiplexed Imaging - Published in JOSS (2026)

https://github.com/fnlcr-dmap/scsaworkflow

Science Score: 87.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software
Last synced: about 1 month ago · JSON representation

Repository

Basic Info
Statistics
  • Stars: 9
  • Watchers: 3
  • Forks: 11
  • Open Issues: 15
  • Releases: 6
Created over 3 years ago · Last pushed about 1 month ago
Metadata Files
Readme Changelog Contributing License

README.md

SPAC: Analysis of SPAtial Single Cell Datasets

SPAC is a scalable, automated pipeline, under the Single Cell Spatial Analysis Workflow (SCSAWorkflow) project aiming at analyzing single-cell spatial protein data of multiplexed whole-slide tissue images generated from technologies such as MxIF Codex and Imaging Mass Cytometry (IMC). This Python-based package leverages the anndata framework for easy integration with other single-cell toolkits. It includes a multitude of functional and visualization modules, test utilities, and is capable of running in user-friendly web interfaces. SPAC offers insights into cell interactions within various environments, aiding in studies of the cancer microenvironment, stem cell niches, and drug response effects etc.

This repository is the official home of the SPAC Python package, part of the broader SPAC ecosystem for single-cell spatial analysis.

SPAC Ecosystem

| Component | Description | Repository | |-----------|-------------|------------| | SPAC Python Package | Core analysis library | This repository | | SPAC Shiny | Interactive web application | FNLCR-DMAP/SPAC_Shiny |

Installing SPAC with Conda

Run the following command to establish the Conda environment supporting usage and contribution to spac package: Latest released version is v0.9.0 at 5/23/2025 ```bash cd git checkout address-reviewer-comments

If conda is not activate

conda activate

Adding constumized scimap conda pacakge channel supported by DMAP

conda config --add channels https://fnlcr-dmap.github.io/scimap/

Create the Conda environment from environment.yml

conda env create -f environment.yml

Once environment is established

conda activate spac

Install the SPAC package in development mode

pip install -e . `` The envrionment works for Linux and noarc, if your are working on amd processor (commonly seen for latest Mac users), please replace the - numpy=1.26.4withnumpy>=1.26.4,<2.0.0, and remove the- scimap=2.1.3dmappandas153but add pip- scimap`

If error occurs suggesting SSL certificate not found for our scimap channel, please run the following command before the environment creation: conda config --set ssl_verify false Then set the verification to True after the installation: conda config --set ssl_verify true

Using SPAC with Docker

For a reproducible environment, you can use Docker to run SPAC.

📘 For detailed Docker documentation including development mode with live code mounting, see docker/README.md

Quick commands: - Production: make buildmake run - Development: make dev (changes to src/ reflected immediately!) - Help: make help

Build the Docker Image

bash docker build -t spac .

Run Jupyter Notebook Server with Your Data

Mount your working directory to access notebooks and data: ```bash

Stop any existing containers using port 8888 (if needed)

docker stop $(docker ps -q --filter "publish=8888") 2>/dev/null || true

From the project root directory

docker run --rm -p 8888:8888 -v $(pwd)/paper/examples:/workspace spac

Or mount any directory containing your notebooks and data

docker run --rm -p 8888:8888 -v /path/to/your/data:/workspace spac ```

Then open your browser to: http://localhost:8888

Test SPAC Installation

To validate that SPAC works correctly, run the notebook execution test: ```bash

Navigate to the paper directory

cd paper

Run the test script in Docker (mounts examples directory and test script)

docker run --rm -v $(pwd)/examples:/workspace -v $(pwd)/testnotebookexecution.sh:/testscript.sh spac bash /testscript.sh ```

This test will: - ✅ Verify SPAC and scimap installation - ✅ Execute the example lymphnode analysis notebook
- ✅ Create a timestamped output file (e.g., lymphnode_analysis_executed_20231023_134803.ipynb) - 📓 Provide instructions for viewing results in Jupyter

View Executed Notebooks

After running the test, you can view the executed notebook in Jupyter: ```bash

Navigate to paper/examples directory

cd paper/examples

Stop any existing containers using port 8888 (if needed)

docker stop $(docker ps -q --filter "publish=8888") 2>/dev/null || true

Start Jupyter server with your data mounted

docker run --rm -p 8888:8888 -v $(pwd):/workspace spac ```

Then open your browser to: http://localhost:8888 and navigate to the timestamped executed notebook file.

Validate Performance Improvements

To verify the performance speedups implemented in SPAC: ```bash

Navigate to the paper directory

cd paper

Run the performance validation script in Docker (mounts current directory for results)

Note: Ensure Docker has at least 16GB memory allocated for full validation

docker run --rm -v $(pwd):/workspace -v $(pwd)/testperformancevalidation.sh:/testscript.sh spac bash /testscript.sh ```

This test will: - ✅ Run boxplot performance benchmarks (up to 10M cells: boxplot vs boxplot_interactive) - ✅ Run histogram performance benchmarks (up to 10M cells: histogram_old vs histogram)
- ✅ Generate detailed speedup analysis with concrete performance improvements - 📊 Generate detailed speedup analysis and performance reports - � Save results to your local performance_results/ directory

Performance results are saved locally as timestamped files in performance_results/: - boxplot_performance_YYYYMMDD_HHMMSS.txt - histogram_performance_YYYYMMDD_HHMMSS.txt

Interactive Shell Access

For debugging or manual exploration: bash docker run --rm -it spac bash

Mount Local Data

To work with your own data, mount a local directory: ```bash

Stop any existing containers using port 8888 (if needed)

docker stop $(docker ps -q --filter "publish=8888") 2>/dev/null || true

Mount your data directory

docker run --rm -p 8888:8888 -v /path/to/your/data:/data spac ```

Docker Cleanup

If you need to clean up Docker resources: ```bash

Stop all SPAC containers

docker stop $(docker ps -q --filter "ancestor=spac") 2>/dev/null || true

Remove stopped containers (optional)

docker container prune -f

Remove SPAC image (if you want to rebuild from scratch)

docker rmi spac ```

Contirbuting to SPAC:

Review the developer guide

License

spac was created by Fang Liu, Rui He, and George Zaki. It is licensed under the terms of the BSD 3-Clause license.

Credits

spac was created with cookiecutter and the py-pkgs-cookiecutter template.

Owner

  • Name: FNLCR-DMAP
  • Login: FNLCR-DMAP
  • Kind: organization

Data Management and Analysis Program at the National Cancer Institute

JOSS Publication

SPAC: A Python Package for Spatial Single-Cell Analysis of Multiplexed Imaging
Published
January 14, 2026
Volume 11, Issue 117, Page 8787
Authors
Fang Liu ORCID
Frederick National Laboratory for Cancer Research, United States of America
Rui He ORCID
Essential Software Inc., United States of America
Andrei Bombin ORCID
Axle Informatics, United States of America
Ahmad B. Abdallah
Purdue University, United States of America
Omar Eldaghar
Purdue University, United States of America
Tommy R. Sheeley
Purdue University, United States of America
Sam E. Ying
Purdue University, United States of America
George Zaki ORCID
Frederick National Laboratory for Cancer Research, United States of America
Editor
Adam Tyson ORCID
Tags
multiplexed imaging spatial proteomics single-cell analysis tumor microenvironment

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 5
  • Total pull requests: 231
  • Average time to close issues: 1 day
  • Average time to close pull requests: 2 days
  • Total issue authors: 3
  • Total pull request authors: 11
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.03
  • Merged pull requests: 180
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 134
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 day
  • Issue authors: 1
  • Pull request authors: 11
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.04
  • Merged pull requests: 100
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • georgezakinih (2)
  • ruiheesi (2)
  • fangliu117 (1)
Pull Request Authors
  • fangliu117 (116)
  • georgezakinih (54)
  • ruiheesi (33)
  • abombin (8)
  • LizaShch (4)
  • oeldaghar (4)
  • ying39purdue (4)
  • arshnrr (3)
  • Ahmad8864 (3)
  • ThomasSheeley (1)
  • ThomasKHu (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

poetry.lock pypi
  • alabaster 0.7.12 develop
  • appnope 0.1.3 develop
  • astroid 2.12.13 develop
  • attrs 22.1.0 develop
  • babel 2.11.0 develop
  • backcall 0.2.0 develop
  • certifi 2022.9.24 develop
  • cffi 1.15.1 develop
  • charset-normalizer 2.1.1 develop
  • click 8.1.3 develop
  • colorama 0.4.6 develop
  • debugpy 1.6.4 develop
  • decorator 5.1.1 develop
  • docutils 0.17.1 develop
  • entrypoints 0.4 develop
  • fastjsonschema 2.16.2 develop
  • greenlet 2.0.1 develop
  • idna 3.4 develop
  • imagesize 1.4.1 develop
  • importlib-metadata 5.1.0 develop
  • importlib-resources 5.10.0 develop
  • ipykernel 6.16.2 develop
  • ipython 7.34.0 develop
  • jedi 0.18.2 develop
  • jinja2 3.1.2 develop
  • jsonschema 4.17.3 develop
  • jupyter-cache 0.5.0 develop
  • jupyter-client 7.4.7 develop
  • jupyter-core 4.12.0 develop
  • lazy-object-proxy 1.8.0 develop
  • markdown-it-py 2.1.0 develop
  • markupsafe 2.1.1 develop
  • matplotlib-inline 0.1.6 develop
  • mdit-py-plugins 0.3.1 develop
  • mdurl 0.1.2 develop
  • myst-nb 0.17.1 develop
  • myst-parser 0.18.1 develop
  • nbclient 0.5.13 develop
  • nbformat 5.7.0 develop
  • nest-asyncio 1.5.6 develop
  • packaging 21.3 develop
  • parso 0.8.3 develop
  • pexpect 4.8.0 develop
  • pickleshare 0.7.5 develop
  • pkgutil-resolve-name 1.3.10 develop
  • prompt-toolkit 3.0.33 develop
  • psutil 5.9.4 develop
  • ptyprocess 0.7.0 develop
  • py 1.11.0 develop
  • pycparser 2.21 develop
  • pygments 2.13.0 develop
  • pyparsing 3.0.9 develop
  • pyrsistent 0.19.2 develop
  • python-dateutil 2.8.2 develop
  • pytz 2022.6 develop
  • pywin32 305 develop
  • pyyaml 6.0 develop
  • pyzmq 24.0.1 develop
  • requests 2.28.1 develop
  • setuptools 65.6.3 develop
  • six 1.16.0 develop
  • snowballstemmer 2.2.0 develop
  • sphinx 5.3.0 develop
  • sphinx-autoapi 2.0.0 develop
  • sphinx-rtd-theme 1.1.1 develop
  • sphinxcontrib-applehelp 1.0.2 develop
  • sphinxcontrib-devhelp 1.0.2 develop
  • sphinxcontrib-htmlhelp 2.0.0 develop
  • sphinxcontrib-jsmath 1.0.1 develop
  • sphinxcontrib-qthelp 1.0.3 develop
  • sphinxcontrib-serializinghtml 1.1.5 develop
  • sqlalchemy 1.4.44 develop
  • tabulate 0.9.0 develop
  • tornado 6.2 develop
  • traitlets 5.6.0 develop
  • typed-ast 1.5.4 develop
  • typing-extensions 4.4.0 develop
  • unidecode 1.3.6 develop
  • urllib3 1.26.13 develop
  • wcwidth 0.2.5 develop
  • wrapt 1.14.1 develop
  • zipp 3.11.0 develop
pyproject.toml pypi
  • python ~3.7.13
.github/workflows/gitflow-py-action.yml actions
src/spac/environment.yml pypi
  • phenograph ==1.5.7
  • poetry *