Spaces:
Running
Running
TuringDNA CRISPR engine — test suite
Dev-only regression net for the live guide-design engine. Not shipped
in the Docker image and intentionally not in requirements.txt (keeps
the HF Space image lean). The CRISPR engine serves real paying customers,
so this suite locks the properties that protect them.
Run
pip install pytest # one-time, dev machine only
pytest -q # from the repo root (hf-space/)
conftest.py puts the repo root on sys.path, so no install/packaging
step is needed.
What's covered
| File | Locks down |
|---|---|
test_crispr.py |
guide coordinates round-trip on both strands; CFD vs Doench 2016 matrix; on-target/KO/indel/base-editor ranges; Cas12a TTTV PAM rules; hostile input (HTML/protein/N) fails safe; CSV/XLSX width + ;-locale safety |
test_cloning.py |
highest-consequence — cloning-oligo overhangs match the published Zhang (Cas9) / Zetsche (Cas12a) conventions exactly; a wrong base here fails a customer's cloning |
test_offtarget.py |
genome off-target search via an injected in-memory index (no network); index builder against a temp FASTA; readiness/status logic |
test_exon.py |
CDS alignment, exon mapping, and NMD-zone rule against a hand-built GeneStructure (no Ensembl calls) |
All tests are pure/stdlib and offline — no NCBI/Ensembl/AlphaFold network
calls. Network paths in offtarget.py / exon.py are exercised only via
their pure helpers and injected fixtures.
Known follow-ups (surfaced by this suite, tracked separately)
- Self-off-target is O(k²) in the number of PAM sites in the input. A multi-hundred-kb paste can tie up the worker. The server caps input at 1 Mbp but does not cap the candidate count. Consider a candidate cap or skipping self-off-target above a size threshold.
Fixed while writing these tests
crispr.pyKO cut-position: a copy-paste artifact made both branches of a ternary identical (cut_position = pos - 3for every Cas9 guide, strand-blind). Now strand-aware and consistent with the exon-annotation cut convention. Display-only (KO efficacy isn't part of the composite ranking), so no guide ordering changed.