Skip to main content

Badges

Docs PyPI version Python version Licence: MIT repo size Tutorial DOI Tests Qt

spaCR

Spatial phenotype analysis of CRISPR-Cas9 screens (spaCR).

The spatial organization of organelles and proteins within cells constitutes a key level of functional regulation. In the context of infectious disease, the spatial relationships between host cell structures and intracellular pathogens are critical to understanding host clearance mechanisms and how pathogens evade them. spaCR is a Python-based software package for generating single-cell image data for deep-learning sub-cellular/cellular phenotypic classification from pooled genetic CRISPR-Cas9 screens. spaCR provides a flexible toolset to extract single-cell images and measurements from high-content cell painting experiments, train deep-learning models to classify cellular/subcellular phenotypes, simulate, and analyze pooled CRISPR-Cas9 imaging screens.

Features

  • Generate Masks: Generate cellpose masks of cell, nuclei, and pathogen objects.

  • Object Measurements: Measurements for each object including scikit-image regionprops, intensity percentiles, shannon-entropy, Pearson’s and Manders’ correlations, homogeneity, and radial distribution. Measurements are saved to a SQL database in object-level tables.

  • Crop Images: Save objects (cells, nuclei, pathogen, cytoplasm) as images. Object image paths are saved in a SQL database.

  • Train CNNs or Transformers: Train Torch models to classify single object images.

  • Manual Annotation: Supports manual annotation of single-cell images and segmentation to refine training datasets for training CNNs/Transformers or cellpose, respectively.

  • Finetune Cellpose Models: Adjust pre-existing Cellpose models to your specific dataset for improved performance.

  • Timelapse Data Support: Track objects in timelapse image data.

  • Simulations: Simulate spatial phenotype screens.

  • Sequencing: Map FASTQ reads to barcode and gRNA barcode metadata.

  • Misc: Analyze Ca oscillation, recruitment, infection rate, plaque size/count.

SpaCr workflow

Overview and data organization of spaCR.

a. Schematic workflow of the spaCR pipeline for pooled image-based CRISPR screens. Microscopy images (TIFF, LIF, CZI, NDI) and sequencing reads (FASTQ) are used as inputs (black). The main modules (teal) are: (1) Mask: generates object masks for cells, nuclei, pathogens, and cytoplasm; (2) Measure: extracts object-level features and crops object images, storing quantitative data in an SQL database; (3) Classify—applies machine learning (ML, e.g., XGBoost) or deep learning (DL, e.g., PyTorch) models to classify objects, summarizing results as well-level classification scores; (4) Map Barcodes: extracts and maps row, column, and gRNA barcodes from sequencing data to corresponding wells; (5) Regression: estimates gRNA effect sizes and gene scores via multiple linear regression using well-level summary statistics. b. Downstream submodules available for extended analyses at each stage. c. Output folder structure for each module, including locations for raw and processed images, masks, object-level measurements, datasets, and results. d. List of all spaCR package modules.

Installation

Linux recommended. If using Windows, switch to Linux—it’s free, open-source, and better.

macOS prerequisites (before install):

brew install libomp hdf5 cmake openssl

Linux GUI requirement: SpaCr GUI requires Tkinter.

sudo apt-get install python3-tk

Installation:

pip install spacr

Run SpaCr GUI:

spacr

Example Notebooks

The following example Jupyter notebooks illustrate common workflows using spaCR.

Interactive Tutorial (under construction)

Click below to explore the step-by-step GUI and Notebook tutorials for spaCR:

Tutorial

Narrated video tutorials

Every home module ships with a scripted narrated MP4 walkthrough that you can regenerate locally on any machine with ffmpeg. The rendering pipeline (spacr.qt.tutorial) uses Piper for neural TTS narration and captures frames directly from the Qt widget tree — no Xvfb needed.

pip install -e '.[tutorial]'
# Fetch a voice model (one-time):
mkdir -p ~/.spacr/piper && curl -sL \
  https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx \
  -o ~/.spacr/piper/en_US-lessac-medium.onnx
curl -sL \
  https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json \
  -o ~/.spacr/piper/en_US-lessac-medium.onnx.json

# Render one tutorial:
spacr-tutorial mask         # → ~/spacr-tutorials/mask.mp4 + mask.srt

# Or every module:
spacr-tutorial all          # → mask, measure, crop, classify,
                             #    timelapse, home under ~/spacr-tutorials

Each MP4 is a 1080p30 clip with a burned-in cursor overlay + AAC narration track and a matching .srt sidecar with the exact narration text. Swap the audio track with your own recording for publish-ready videos.

spaCRPower

Power analasys of pooled perterbation spaCR screens.

spaCRPower

Data Availability

License

spaCR is distributed under the terms of the MIT License. See the LICENSE file for details.

How to Cite

If you use spaCR in your research, please cite: Olafsson EB, et al. A pooled image-based CRISPR screen identifies EAF1 as a T. gondii modulator of 2 ESCRT subversion. Manuscript under consideration.

Papers Using spaCR

Below are selected publications that have used or cited spaCR:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spacr_nightly-1.4.0.tar.gz (72.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spacr_nightly-1.4.0-py3-none-any.whl (28.4 MB view details)

Uploaded Python 3

File details

Details for the file spacr_nightly-1.4.0.tar.gz.

File metadata

  • Download URL: spacr_nightly-1.4.0.tar.gz
  • Upload date:
  • Size: 72.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for spacr_nightly-1.4.0.tar.gz
Algorithm Hash digest
SHA256 2997191532c4bd2f7762f4daaa92ee2b8e80f09a5242bc81580aa06c04e2bb01
MD5 6bc75b104872a97fbfec25291a13bc1a
BLAKE2b-256 b5ac5520e2cbfecbd30741dd4a15cfcd90f598496cb26f4e5582766cd410e856

See more details on using hashes here.

File details

Details for the file spacr_nightly-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: spacr_nightly-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 28.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for spacr_nightly-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cf0460423defb97106b2195bcf44bddc254a83f9e4c19e6f67b780c21f1ad0d
MD5 afa40c259f0df904501a64318f8144cb
BLAKE2b-256 6a4ed6d7948a2616125f01d5743b6da86cd478499541fd85dee64e81ef284e60

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 files

1.3.4

2 files

1.3.3

2 files

1.3.1

2 files

1.2.6

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

1 file

1.2.1

2 files

1.1.7

2 files

1.1.5

2 files

1.1.4

2 files

1.1.3

2 files

1.1.1

2 files

1.1.0

2 files

1.0.9

2 files

1.0.7

2 files

1.0.6

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page