8000 GitHub - alvin-hsu/optiprime-src: Source code for Hsu, Chen, Li, et al. Mechanistic machine learning for prediction of prime editing outcomes. Nat. Biotechnol. (2026) · GitHub
[go: up one dir, main page]

Skip to content

About

Source code for Hsu, Chen, Li, et al. Mechanistic machine learning for prediction of prime editing outcomes. Nat. Biotechnol. (2026)

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

OptiPrime

This is the original source code repository for the OptiPrime project. We will provide a Docker container that allows for easier pegRNA design upon paper release (see Dockerfile). This repository contains code that was used to train OptiPrime.

The script used to pre-train the HetFormer is at scripts/pe/0_pretrain_edit.py.

The script used to train OptiPrime is at scripts/pe/1_train.py.

Installing OptiPrime

To install OptiPrime, simply clone this repository and run:

pip install -r requirements.txt

We have verified that this installation takes ~10 minutes on MacOS or Linux.

Designing pegRNAs

To design new pegRNAs, run the script DESIGN_PE.py as follows:

python DESIGN_PE.py \
--run_data YOUR_JOB.json \
--graph_rx graphs/pe_model.rx \
--weight_dirs weights/* \
--out_path OUTPUT_DIR/ 

YOUR_JOB.json should be JSON-formatted file with entries structured like:

[
    {
        "name": "NAME_OF_JOB",
        "unedited": "UNEDITED_SEQUENCE",
        "edit_segments": [
            ["SEGMENT_1"],
            ["SEGMENT", "2", "OPTIONS"]
        ]
    }
]

An example of a file is COL7A1_R185X.json.

The unedited sequence should be formatted to start 4 bp upstream of the 20-bp protospacer:

pad- [   protospacer    ] pam-
NNNN NNNNNNNNNNNNNNNNNNNN NNNN NNNNNN...
(but with no spaces)

The edit_segments are silent edit options that should be tried combinatorially. For example, you might want to use codons:

"edit_segments": [
    ["AGTACTCAGATGCATGCAGTC"],
    ["GCA", "GCC", "GCG", "GCT"],
    ["CCA", "CCC", "CCG", "CCT"],
    ["AGATAGTCATCGCTATCGATGATCGTACG"]
]

Here, the only codons that we are varying are an alanine and a proline. The script will automatically generate all 16 possible codon combinations and evaluate them.

About

Source code for Hsu, Chen, Li, et al. Mechanistic machine learning for prediction of prime editing outcomes. Nat. Biotechnol. (2026)

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0