A model for predicting HDR frequencies using in silico NHEJ prediction data as input
31
A containerized toolkit for turning SelfTarget/FORECasT CRISPR/Cas9 repair predictions into a compact feature vector and scoring it with a trained homology‑directed‑repair (HDR) model.
The tool does two things:
*_predictedindelsummary.txt and
*_predictedreads.txt files into a single‑row feature CSV
(deletion/insertion frequencies, entropy, templated‑insertion %, MMEJ %, etc.).HDR_Model.joblib) and predicts an HDR class + probability from
those features.Both steps run inside a single Docker image via one entry point (run_hdr.py).
Feature annotation emits a single row per gRNA with these columns (0–100 scale unless noted):
| Feature | Definition |
|---|---|
percentDeletions | % of editing events that contain a deletion |
Entropy | Shannon entropy of the editing‑event frequency vector (scipy.stats.entropy, natural log; excludes the unedited - event) |
2+DelFreq | % of editing events that are deletions ≥ 2 bp |
4+DelFreq | % of editing events that are deletions ≥ 4 bp |
percentInsertions | % of editing events that contain an insertion |
1InsFreq | % of editing events that are 1 bp insertions |
percentTemplatedInsertion | Of insertion events, % whose inserted base(s) duplicate the directly adjacent template (5′ or 3′) |
Top2AFFreq | Cumulative % of the two most frequent editing events |
percentMMEJ | Of deletion events, % with ≥ 2 bp microhomology (taken directly from the FORECasT event‑ID C field) |
To start you will need to ensure you have run the FORECasT tool and generated the following two files for the gRNA(s) of interest:
For simplicity of the docker command we will assume both of these are in the active working directory. To end-to-end annotate features and do predictions for the gRNA using these indel profiles, run the following:
docker run --rm \
--user "$(id -u):$(id -g)" \
-v "$PWD:/data" \
hdr-model:latest pipeline \
-s /data/results_predictedindelsummary.txt \
-r /data/results_predictedreads.txt \
-n NAME \
-o /data/NAME_scored.csv
The primary output NAME_scored.csv can be named using the -n parameter and contains the following information:
Name,prediction,probability
NAME,1,0.87
---
## Command reference
The entrypoint `run_hdr.py` exposes three subcommands.
### `features` — annotation only
```bash
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/data" \
hdr-model:latest features \
-s /data/results_forecastpredictedindelsummary.txt \
-r /data/results_forecastpredictedreads.txt \
-n NAME \
-o /data/NAME_features.csv
predict — score an existing feature CSV with the baked‑in modeldocker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/data" \
hdr-model:latest predict \
-i /data/NAME_features.csv \
-o /data/NAME_scored.csv \
--id-column Name \
--threshold 0.5
pipeline — features → predict in one calldocker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/data" \
hdr-model:latest pipeline \
-s /data/results_forecastpredictedindelsummary.txt \
-r /data/results_forecastpredictedreads.txt \
-n NAME \
-o /data/NAME_scored.csv \
--features-out /data/NAME_features.csv # optional: keep intermediate CSV
prediction is derivedprediction = 1 if probability >= threshold (default threshold = 0.5)
prediction = 0 otherwise
The probability is produced by a calibrated classifier, so it is intended to be
read as a genuine likelihood rather than an uncalibrated score. A value near
0.5 means the model is uncertain; values near 0 or 1 indicate
confident calls.
The positive class corresponds to the target column the model was trained on — which in this case was the class of being in the top 60% of HDR gRNA. This corresponds to how the model was used in the original manuscript.
--threshold trades precision vs. recall and does not require
retraining — it only re‑bins the same probabilities produced by the model:
| Goal | Suggested threshold | Effect |
|---|---|---|
| Catch as many true HDR‑favorable guides as possible | lower (e.g. 0.3) | ↑ recall, ↑ false positives |
| Only flag high‑confidence HDR‑favorable guides | higher (e.g. 0.7) | ↑ precision, ↑ false negatives |
| Balanced default | 0.5 | Even trade‑off , recommended |
Because probability is written to every row, you can re‑threshold downstream
in a spreadsheet or pandas without re‑running the container as well if desired.
© Integrated DNA Technologies, Inc. (IDT). All rights reserved.
This tool is provided free of charge for academic, non‑commercial research use only. Commercial use of any kind requires explicit prior written consent from IDT.
To request commercial‑use permission, please contact the author: 📧 [email protected]
Content type
Image
Digest
sha256:9efb4e3f0…
Size
672 MB
Last updated
3 months ago
docker pull idtdna/hdr-model:v1.0