Examples Overview¶
This page provides an overview of the available examples and how to use them for diSPIM data processing with PySPIM.
Examples Directory Structure¶
The examples/ directory contains actual example code and data:
examples/
âââ snakemake/ # Snakemake workflow
â âââ Snakefile # Main workflow definition
â âââ config.yaml # Configuration file
â âââ slurm.yaml # SLURM cluster configuration
â âââ scripts/ # Workflow scripts
âââ data/ # Example data
â âââ sample_data/ # GitHub-friendly sample data
â â âââ basic_usage.ipynb # Complete workflow notebook
â â âââ sh/ # SLURM job scripts
â â âââ README.md # Usage instructions
â âââ example_dispim_data/ # Full example datasets
âââ nb/ # Jupyter notebooks
âââ basic_usage.ipynb # Basic usage example
Available Examples¶
1. Snakemake Workflow¶
Location: examples/snakemake/
A complete Snakemake workflow for automated diSPIM processing pipeline.
Features:
- Complete processing pipeline (load â ROI â deskew â deconvolve â save)
- SLURM cluster integration
- Uses example data from examples/data/
- Modular and extensible design
Quick Start:
SLURM Execution:
Documentation: See Snakemake Workflow for detailed instructions.
2. Sample Data and Scripts¶
Location: examples/data/sample_data/
Contains sample data and SLURM job scripts for testing PySPIM functionality.
Contents:
- basic_usage.ipynb - Complete workflow demonstration
- sh/ - SLURM job scripts for batch processing
- README.md - Detailed usage instructions
Usage:
3. Jupyter Notebooks¶
Location: examples/nb/
Contains standalone Jupyter notebooks demonstrating PySPIM usage.
Contents:
- basic_usage.ipynb - Basic usage example
Data Sources¶
Example Data¶
The examples use data from examples/data/fruiting_body_subset/:
- fruiting_body_subset.ome.tif - Multi-channel TIFF data
- PSFA_demo.npy - PSF for channel A
- PSFB_demo.npy - PSF for channel B
- acquisition_params.txt - Acquisition parameters
Using Your Own Data¶
- For Snakemake: Update
config.yamlwith your data paths and parameters - For Notebooks: Modify the data paths in the notebook cells
- For SLURM Scripts: Update the paths in the shell scripts
Integration Examples¶
Snakemake Integration¶
Nextflow Integration¶
Convert the Snakemake workflow to Nextflow processes.
Galaxy Integration¶
Use individual scripts as Galaxy tools.
Workflow Comparison¶
| Feature | Snakemake Workflow | Jupyter Notebooks | SLURM Scripts |
|---|---|---|---|
| Use Case | Automated processing | Interactive exploration | Batch processing |
| ROI Selection | Automatic only | Manual or automatic | Manual or automatic |
| Processing Steps | Complete pipeline | Step-by-step | Individual steps |
| Scalability | Multiple acquisitions | Single acquisition | Multiple acquisitions |
| Cluster Support | SLURM integration | Manual submission | Direct SLURM |
| Reproducibility | Automated | Manual | Manual |
| Learning Curve | Moderate | Low | Low |
Recommendations¶
For Production Workflows¶
- Use the Snakemake workflow for automated processing
- Ideal for multiple acquisitions
- Excellent for cluster environments
- Ensures reproducibility
For Learning and Development¶
- Use Jupyter notebooks for interactive exploration
- Good for understanding individual steps
- Easy to modify and experiment
For Integration¶
- Snakemake workflow is particularly suitable for HPC environments
- Can be integrated into larger bioinformatics pipelines
- Individual scripts can be used as building blocks
Troubleshooting¶
Common Issues¶
- napari not found: Install with
pip install napari - Memory issues: Reduce data size or use chunked processing
- SLURM errors: Check
slurm.yamlconfiguration - GPU errors: Ensure CUDA is available and GPU memory is sufficient
Getting Help¶
- Check the individual README files in each example directory
- Review the PySPIM documentation
- Examine the example data structure for reference
- Open an issue on GitHub for specific problems
Contributing Examples¶
To add new examples:
- Create a new directory or file in
examples/ - Include a README with usage instructions
- Use the example data when possible
- Document integration possibilities
- Test with the provided example data
- Update this overview page
Next Steps¶
- Try the Basic Usage tutorial
- Explore the Snakemake Workflow
- Check out Advanced Features
- Review the API Reference