Calcium Image Processing Nextflow pipeline for the Arc Institute.
Lizard Wizard automates detection, segmentation, and analysis of calcium signals from 2D/3D fluorescence imaging. It integrates CaImAn, Cellpose, and Wizards Staff to produce high-quality metrics and visualizations for downstream analysis.
- Lizard Wizard
- Table of Contents
- What is Lizard Wizard?
- Key Features
- Workflow Diagram
- Quick Start
- Installation
- Conda & mamba install
- Nextflow install
- Pipeline install
- Usage
- Wizards Staff Integration
- Tutorials and Guides
- Best Practices
- Advanced Usage
- Secrets
- Quick Troubleshooting
- Output Files
- Citation
- License
- Acknowledgments
Lizard Wizard is a reproducible Nextflow pipeline that takes raw time-lapse fluorescence imaging and returns curated calcium activity traces, ROIs, QC plots, and advanced metrics. It integrates:
- CaImAn for calcium event extraction
- Cellpose for segmentation/masking
- Wizards-Staff for clustering, correlations, and summary metrics
This integrated approach is designed for biologists who need robust analysis without writing custom code for every dataset.
- End-to-end workflow: Ingest → Mask → CaImAn → ΔF/F₀ → Metrics → Reports
- CaImAn-based extraction: Spatial footprints, temporal traces, and denoised activity
- Cellpose segmentation: Reliable ROIs for 2D cultures and 3D organoids
- Wizards Staff metrics: Clustering, pairwise correlations, FRPM, rise time, FWHM
- Reproducible by design: Nextflow + Conda/Singularity for portable, pinned environments
- HPC-ready: SLURM-friendly profiles and scratch work directories
- Interoperable outputs: NPY/CSV/PNG organized for downstream analysis
flowchart LR
A[Raw images (Zeiss/MolDev)] --> B[Masking (Cellpose)]
B --> C[CaImAn extraction]
C --> D[ΔF/F₀ normalization]
D --> E[Wizards Staff metrics]
E --> F[Reports, plots, CSV, NPY]
Run a spot check on a few images (recommended):
nextflow run main.nf \
-profile conda,slurm \
-work-dir /scratch/$(id -gn)/$(whoami)/nextflow-work/lizard-wizard \
--input_dir /path/to/images/ \
--output_dir /path/to/output/ \
--test_image_count 2 \
-N [email protected]Then process the full dataset, reusing results:
nextflow run main.nf \
-profile conda,slurm \
-work-dir /scratch/$(id -gn)/$(whoami)/nextflow-work/lizard-wizard \
--input_dir /path/to/images/ \
--output_dir /path/to/output/ \
-N [email protected] \
-resumeExpected outputs are written to --output_dir (see Output Files Guide).
mamba is needed to run the pipeline. It is a faster version of conda. mamba can be installed via conda.
To install both conda and mamba, see the conda/mamba Notion docs.
It is easiest to install Nextflow using mamba:
mamba install -n nextflow_env -c bioconda nextflowMake sure to activate the environment before running the pipeline:
mamba activate nextflow_envgit clone [email protected]:ArcInstitute/Lizard-Wizard.git \
&& cd Lizard-WizardHTTPS (simplest, no SSH keys needed):
git clone https://github.com/ArcInstitute/Lizard-Wizard.git
cd Lizard-WizardSSH (requires GitHub auth/key):
git clone [email protected]:ArcInstitute/Lizard-Wizard.git
cd Lizard-WizardOption 1: Switch to HTTPS:
git clone https://github.com/ArcInstitute/Lizard-Wizard.gitOption 2: Set up GitHub CLI and authenticate (works well on HPC nodes):
conda install -c conda-forge gh
gh auth loginFollow the prompts to authenticate with your GitHub account (HTTPS or SSH).
Test your SSH:
ssh -T [email protected]Retry the clone:
git clone [email protected]:ArcInstitute/Lizard-Wizard.gitNote for internal users:
- If your organization restricts outbound SSH, prefer the HTTPS clone method.
- Ensure your
$HOME/.sshand$HOME/.configare writable or use HTTPS +ghtoken auth.
The first time you run the pipeline, Nextflow will automatically create all necessary conda environments. This process may take some time but only happens once.
Note: it can take a while to create the environments, even with mamba.
For reproducible runs on Arc Internal Cluster, use Singularity containers built from the singularity/*.def files.
Build all containers and validate:
./build_singularity_containers.sh
./validate_singularity_setup.shRun the pipeline with Singularity profiles:
nextflow run main.nf \
-profile singularity,chimera,slurm \
-work-dir /scratch/$(id -gn)/$(whoami)/nextflow-work/lizard-wizard \
--input_dir /path/to/your/images/ \
--output_dir /path/to/output/location/ \
--test_image_count 2We recommend a two-step approach:
-
Spot Check: Run the pipeline on a few images first to verify parameters. This will run Lizard Wizard utilizing preset parameters, we recommend reading through the general Tutorial for detailed information on how to adjust parameters to your dataset during this step.
nextflow run main.nf \ -profile conda,slurm \ -work-dir /scratch/$(id -gn)/$(whoami)/nextflow-work/lizard-wizard \ --input_dir /path/to/image/files/ \ --output_dir /path/to/output/location/ \ --test_image_count 3 \ -N [email protected]
Update
-work-diras needed for your file system -
Full Run: Process the entire dataset using the same output directory
nextflow run main.nf \ -profile conda,slurm \ -work-dir /scratch/$(id -gn)/$(whoami)/nextflow-work/lizard-wizard \ --input_dir /path/to/image/files/ \ --output_dir /path/to/output/location/ \ -N [email protected] \ -resume
Update
-work-diras needed for your file system
- Nextflow: >= 24.10.0 recommended
- Singularity or Apptainer
- SLURM access on Chimera
- Access to shared container directory:
/large_storage/multiomics/public/singularity/lizard-wizard
/large_storage/multiomics/public/singularity/lizard-wizard/
├─ caiman.sif
├─ cellpose.sif
├─ summary.sif
└─ wizards_staff.sif
- -profile singularity: enables containers and maps process labels to the above
.sifpaths viaparams.singularity_path. - -profile chimera_singularity: convenience profile combining Singularity + Chimera site defaults (if configured).
- You can override the container root with
--singularity_pathif containers live elsewhere.
- Set the Singularity path if not defined in configs:
--singularity_path /large_storage/multiomics/public/singularity/lizard-wizard
- Recommended scratch work dir:
-work-dir /scratch/$(id -gn)/$(whoami)/nextflow-work/lizard-wizard
Option A: Use the generic Singularity profile
nextflow run main.nf \
-profile singularity \
-work-dir /scratch/$(id -gn)/$(whoami)/nextflow-work/lizard-wizard \
--singularity_path /large_storage/multiomics/public/singularity/lizard-wizard \
--input_dir /path/to/your/data/ \
--output_dir /path/to/save/data/to/ \
--file_type moldev \
etc...Add -resume to reuse completed tasks:
... -resume- Use
--output_dirfor results. - If enabled, reports and traces are written to
${output_dir}/nf-report/and${output_dir}/nf-trace/.
The pipeline has many configurable parameters that can be set via command line or config files. See either nextflow.config or the general Tutorial for detailed information about setting these parameters for your specific data type.
Key parameters include:
--input_dir: Path to input images--output_dir: Where to save results--file_type: Set to "moldev" or "zeiss" depending on your microscope--use_2d: Set totruefor 2D images instead of 3D (default:false)--test_image_count: Number of random images to process for testing--test_image_names: Specify particular images to process (comma-separated)
For parameter selection strategies and recommended starting values by data type, see the Tutorial.
Outputs from CaImAn and ΔF/F₀ data are automatically passed to Wizards Staff to compute clustering, correlations, firing rate per minute, rise time, FWHM, and additional QC plots. You can find these results under wizards-staff/ in your --output_dir. See the Output Files Guide for details and the Tutorial for how to tune inputs that affect downstream metrics.
For detailed guidance on how to use Lizard Wizard and the accompanying Wizards Staff with your data, see:
- Lizard Wizard Tutorial — Parameter selection, datasets, and workflows
- Output Files Guide — What each file means and how to use it
- Troubleshooting Guide — Common issues and diagnostic commands
- Organize data per experiment with clear folder names and metadata (
metadata.csvproduced in outputs can be extended). - Start with a spot check (
--test_image_count) to tune--gSig,--min_corr,--min_pnr. - Use a scratch
-work-diron fast storage; add-resumefor iterative runs. - Record the exact command and Nextflow version used for each production run.
- Batch processing: submit multiple Nextflow runs by condition, pointing to the same
-work-dirand distinct--output_dirper condition. - Custom parameters: use a Nextflow
-params-file params.jsonto store a reusable configuration. - Profiles: create site- or lab-specific profiles in
nextflow.configfor CPUs, memory, and container paths.
[Optional] The pipeline uses gpt-4o(-mini) to summarize the log files.
This optional feature requires an OPENAI_API_KEY to be set as a Nextflow secret.
To set the secret (assuming that OPENAI_API_KEY is set in the environment):
nextflow secrets set OPENAI_API_KEY $OPENAI_API_KEYNotes:
- If you do not set
OPENAI_API_KEY, then the log summaries will be blank.
- Nextflow not found: ensure you activated the env (
conda activate nextflow_env). - Pipeline stalls/fails: check
.nextflow.logandlogs/under--output_dir, then re-run with-resume. - No neurons detected: lower
--min_corr/--min_pnr, verify--gSigand masking outputs. - See the full Troubleshooting Guide for more.
See the Output Files Guide for structure, examples, and how to load data in Python/R.
If you use Lizard Wizard in your research, please cite the repository and the underlying tools:
- Lizard Wizard (this repository)
- CaImAn: Giovannucci et al., eLife (2019)
- Cellpose: Stringer et al., Nat Methods (2021)
- Wizards Staff (Repo, Arc Institute)
This project is licensed under the MIT License - see the LICENSE file for details.
- CaImAn for calcium imaging analysis
- Cellpose for cell segmentation
- Nextflow for workflow management
- Arc Institute for supporting this research
