This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CRISPResso2 is a bioinformatics pipeline for analyzing CRISPR/Cas9 genome editing outcomes from deep sequencing data. It aligns reads to reference amplicons, quantifies indels/mutations, and generates reports and visualizations.
Documentation: https://docs.crispresso.com
# Preferred (matches CI/task contract)
pixi install -e default
pixi run install
# Alternative
pip install -e .Unit tests (pytest):
# Preferred (explicit test lane)
pixi install -e test
pixi run -e test test
# Direct pytest alternatives
pytest tests/unit_tests/
# With coverage
pytest tests --cov CRISPResso2
# Single test file
pytest tests/unit_tests/test_CRISPRessoCORE.py
# Single test
pytest tests/unit_tests/test_CRISPRessoCORE.py::test_function_nameIntegration tests (from sibling ../CRISPResso2_tests directory):
cd ../CRISPResso2_tests
make install # Installs CRISPResso2 from ../CRISPResso2
make basic # Run basic test only
make basic test # Run basic test and diff against expected results
make all # Run all integration tests
make all test # Run all tests and diff against expected results
make clean # Remove test output directoriesIndividual integration test targets:
make basic- Basic core analysis (CRISPResso_on_FANC.Cas9)make params- Analysis with advanced parametersmake batch- Batch processingmake pooled- Pooled ampliconsmake wgs- WGS analysismake compare- Sample comparisonmake aggregate- Aggregate analysismake prime-editor- Prime editing analysismake base_editor- Base editing analysis
Add test target to diff results against expected: make basic test
CRISPRessoPro lanes:
# Runtime/dev lane (run Pro code)
pixi install -e pro
pixi run -e pro install-pro
# Testing lane (Pro + test deps)
pixi install -e test-pro
pixi run -e test-pro install-pro
pixi run -e test-pro pro-unit-testCRISPResso -r1 reads.fastq -a AMPLICON_SEQUENCE -g GUIDE_SEQUENCE
CRISPRessoBatch -bs batch_file.txt -a AMPLICON_SEQUENCE -g GUIDE_SEQUENCE
CRISPRessoPooled -r1 reads.fastq -f amplicons.txt
CRISPRessoWGS -b aligned.bam -r reference.fa -f regions.txt
CRISPRessoCompare sample1_dir/ sample2_dir/
CRISPRessoAggregate -p 'CRISPResso_on_*'Each tool has a corresponding *CORE.py module with a main() function:
| Command | Module |
|---|---|
CRISPResso |
CRISPRessoCORE.py |
CRISPRessoBatch |
CRISPRessoBatchCORE.py |
CRISPRessoPooled |
CRISPRessoPooledCORE.py |
CRISPRessoWGS |
CRISPRessoWGSCORE.py |
CRISPRessoCompare |
CRISPRessoCompareCORE.py |
CRISPRessoPooledWGSCompare |
CRISPRessoPooledWGSCompareCORE.py |
CRISPRessoAggregate |
CRISPRessoAggregateCORE.py |
CRISPRessoCORE.py(~8,600 lines) - Main analysis engine: read alignment, indel quantification, result aggregationCRISPRessoShared.py- Exception classes, logging utilities, version info, shared helper functionswriters/vcf.py- VCF writing, alternate allele mapping, edit processingCRISPRessoPlot.py(~6,000 lines) - All matplotlib/seaborn visualizationsCRISPRessoMultiProcessing.py- Parallel processing orchestration
CRISPResso2Align.pyx- Custom sequence alignment algorithmsCRISPRessoCOREResources.pyx- Data structures includingResultsSlotsDictfor efficient result storage
Pre-compiled .so files exist for macOS (x86_64, arm64) and Linux (x86_64). Rebuild with pip install -e . if modifying .pyx files.
CRISPRessoReports/CRISPRessoReport.py- Jinja2-based HTML report generation- Templates:
CRISPRessoReports/templates/- HTML templates for each tool type
args.json- Central parameter definitions for all tools. Contains argument names, types, defaults, help text, and which tools each parameter applies to.
Required system tools (for pooled/WGS analysis):
bowtie2- Read alignmentsamtools- BAM file processingfastp- Quality filtering (optional)
See design_docs/ for detailed write-ups on specific subsystems and past debugging decisions:
LEFT_NORMALIZATION.md- VCF indel left-normalization inwriters/vcf.py: why it's needed, how the fix works, key data structures
- Python 3 only
- numpy < 2 required (see test_env.yml)
- Cython build requires numpy headers at compile time