ZFN Module Guide
⚠️ EXPERIMENTAL — results are not decision-grade
The ZFN arm remains experimental; remaining integration and validation work is tracked in #82. Do not use ZFN output for decisions without independent validation. The integration and engineering defects tracked in #82 are addressed; independent genomic and experimental validation remains outstanding.
Supply both half-sites 5′→3′ on their respective binding strands. For the published CCR5 plus-strand genomic text
GTCATCCTCATC+ spacer +AAACTGCAAAAG, use left queryGTCATCCTCATCand right queryCTTTTGCAGTTT. Both FokI-proximal query regions are their final (3′) bases. The default requires inward-facing+...-binding geometry.This development revision fixes right-half-site seed/polarity, nested-interval annotation, canonical mismatch-pattern expansion, empty CSV output, live FM-index cache identity, boundary ownership and bridge CSV evidence loss. The public Nextflow route is available as an opt-in full-reference task; independent genomic/experimental validation remains outstanding.
Artifact migration: new
worst_site_scoreis the maximum concerning off-target score (highest risk);best_offtarget_scoreis the minimum (lowest risk). Older v1 artifacts stored these values inverted and must be regenerated, not relabelled.
This guide is the user-facing entry point for ZFN design and off-target analysis in siRNAforge.
Current implementation status (PR #61: dev → master)
Completed
✅ ZFN support is available through the dedicated
sirnaforge zfn ...command.✅ Typed models and JSON-serializable workflow artifacts are implemented (
sirnaforge.models.zfnandcandidate_summary.jsonoutput).✅ Output/reporting follows existing workflow conventions, including:
sirnaforge/candidate_summary.jsonsirnaforge/offtarget_sites.csvlogs/workflow_summary.json
✅ Workflow provenance is captured in
workflow_summary.json.✅ Nextflow-backed ZFN execution is available through the configured workflow path, including shard commands for full-reference runs. Keep it experimental pending independent validation.
✅ Automated tests exist for ZFN workflow, search/design behavior, and integration paths.
✅ User/developer documentation for ZFN workflow usage is present.
Not implemented in this PR branch
❌ Distinct
repeat_motifmode is not implemented; current implementation focuses on nuclease-style half-site pair workflow.
What the ZFN module does
Scores a user-provided left/right half-site pair.
Searches a genomic FASTA for candidate off-target pairings.
Ranks results and writes candidate + site reports.
Supports scalable shard-based execution for large references.
CLI usage
Required inputs for sirnaforge zfn
When using the ZFN command, both half-sites are required:
--zfn-left-half-site--zfn-right-half-site
The workflow exits with a validation error if either flag is missing.
ZFN command
sirnaforge zfn \
--zfn-left-half-site GTCATCCTCATC \
--zfn-right-half-site CTTTTGCAGTTT \
--zfn-search-space ensembl_human_hg38_primary \
--zfn-spacer-lengths 5,6 \
--zfn-max-mismatches 2 \
--zfn-algorithm zfn_v2 \
--output-dir zfn_output
CTTTTGCAGTTT is the reverse complement of the published CCR5 (−) half-site AAACTGCAAAAG.
Supply each query in its binding-strand orientation as described above. The default backend
supports the canonical 12 bp / 4-mismatch case. Highly
degenerate queries can still exceed its pattern safety limit; compare with
exhaustive_python before interpreting a result.
Outputs are written under:
zfn_output/sirnaforge/candidate_summary.jsonzfn_output/sirnaforge/offtarget_sites.csvzfn_output/logs/workflow_summary.json
candidate_summary.json uses a stable envelope with:
schema_version(currentlyzfn_candidate_summary.v2)search_contract(canonical half-sites, spacer list, mismatch budgets, dimer mode, algorithm)candidatesandsummary
workflow_summary.json records ZFN provenance fields including algorithm, dimer_mode, spacer_lengths, mismatch thresholds, and resolved search-space input (search_space_reference/search_space_fasta).
Common ZFN options
--zfn-algorithm:homology,conserved_g,zfn_v2--zfn-dimer-mode:heterodimer_only(default) orinclude_homodimers--zfn-spacer-lengths: comma-separated allowed spacers (for example5,6)--zfn-max-mismatches: mismatch cap per half-site during exhaustive search--zfn-annotation: optional GTF/GFF annotation for region classification
Search-space references
--zfn-search-space accepts a local FASTA path, an HTTP(S) URL, or one of the built-in
Ensembl genome keys (auto-downloaded and cached on first use):
Key |
Species |
Assembly |
Ensembl DNA file |
|---|---|---|---|
|
human |
GRCh38 |
primary assembly |
|
mouse |
GRCm39 |
primary assembly |
|
rat |
GRCr8 |
toplevel |
|
rhesus macaque |
Mmul_10 |
toplevel |
Rat and macaque use Ensembl’s toplevel DNA file because those assemblies do not publish a
separate primary_assembly FASTA. Genomic DNA references are large (~700 MB–3 GB); the first
run downloads and caches them under ~/.cache/sirnaforge/genomes/.
Backend choice
The backend tuning work settled on this operational order:
pyahocorasickfor the practical first run on large genomic referencesfm_indexonly for repeated persisted-index reuse workflows (experimental on large references)exhaustive_pythonas the strict baseline and fallback path
See Developer Documentation for the backend tuning summary and the hg38 primary validation commands used to reach that conclusion. Those runs used the published CCR5 half-site pair directly, so they matched no on-target site; treat the backend ordering as a runtime observation only, not as a correctness result.
For larger genomes or advanced runtime control, see the workflow-level environment toggles documented in Workflows.
Legacy note: sirnaforge workflow --design-mode zfn remains a compatibility path, but sirnaforge zfn is the primary entrypoint.
Python API quickstart
from sirnaforge.models.zfn import ZFNDesignParameters
from sirnaforge.zfn.design import ZFNDesigner
params = ZFNDesignParameters(
left_half_site="GTCATCCTCATC",
# Reverse complement of the published (-) half-site AAACTGCAAAAG. The published text
# matches nothing under the default require_opposite_strands=True -- see issue #82.
right_half_site="CTTTTGCAGTTT",
search_space_reference="ensembl_human_hg38_primary",
)
result = ZFNDesigner().evaluate_pair(params=params)
print(result.get_summary())
evaluate_pair logs the experimental notice (issue
#82) at WARNING on first use, so it
appears even in a script that configures no logging. result.candidates[0].worst_site_score and
.best_offtarget_score now follow maximum-risk/minimum-risk semantics respectively.
Regenerate older v1 artifacts as described in the banner above.
API map for ZFN users
See these sections in API Reference:
ZFN Models (
sirnaforge.models.zfn) for typed constraints and result structures.ZFN Design (
sirnaforge.zfn.design) for pair evaluation orchestration.ZFN Search (
sirnaforge.zfn.search) for exhaustive/site search and sharding behavior.ZFN Ranking (
sirnaforge.zfn.rank) for deterministic ranking utilities.Workflow Orchestration (
sirnaforge.workflow) forrun_sirna_workflow(...)withdesign_mode="zfn".