dgrec
Overview
DGRec is an in vivo hypermutation technique that combines two biological systems:
- DGR (Diversity Generating Retroelement): the DGR reverse transcriptase (bRT) and its accessory protein Avd reverse-transcribe the template region (TR), a segment of a small non-coding RNA called the dgrRNA, making errors predominantly at adenine positions.
- Recombineering (CspRecT + mutL*): the single-strand annealing protein CspRecT integrates the mutagenic cDNA into the variable region (VR) of a target gene, while mutL* prevents mismatch repair from correcting the mutations.
This creates a powerful tool for targeted in vivo diversification in E. coli, where adenine positions within the TR are selectively mutagenized while other bases remain largely unchanged.
The dgrec package provides tools to:
- Design TR sequences: score a candidate TR from the predicted folding of its dgrRNA, and recode a poorly mutagenic one using codon substitutions that leave the protein encoded by the target gene unchanged
- Predict the diversity a TR will generate: an LSTM model of the position- and context-dependent error profile of the reverse transcriptase, used to simulate the VR sequences reachable from a given TR
- Call genotypes from amplicon sequencing data (single-end or paired-end), with UMI-based deduplication to correct PCR and sequencing errors
- Visualize mutation profiles at nucleotide and amino acid resolution
Source code: github.com/dbikard/dgrec
Documentation: dbikard.github.io/dgrec
Publication: Rochette et al., Diversity-generating retroelements for programmable targeted hypermutagenesis, Nature Biotechnology (2026)
Install
dgrec requires Python 3.10 to 3.13 and installs with pip. The distribution is
named dgrec-tools because dgrec was already taken on PyPI; the import name is
still dgrec:
pip install dgrec-tools
All dependencies, including ViennaRNA, are installed automatically — no conda environment is needed.
The LSTM model needs TensorFlow, which is an optional extra because it is large:
pip install "dgrec-tools[lstm]"
Quick start
dgrec is used at two points in a DGRec experiment: beforehand, to choose a template region
that will actually be mutagenized, and afterwards, to measure what the experiment produced.
The package ships with a small example dataset, so the code below runs as written.
Before the experiment — score a candidate TR, from 0 (poor) to 1 (good):
import dgrec
dgrec.tr_score('AAATGATCGCCAAATCTGAACAGGAAATTGGCAAAGCAACCGCTAAATACTTTTTCTACTCAAACATTAT')
0.84
A sequence that scores poorly can usually be rescued by recoding. The TR is itself non-coding, but it is read in the frame of the gene that carries the variable region (VR) it diversifies, so the substitutions are chosen to leave that protein unchanged. Making the same changes in the VR keeps the two homologous, which is what the recombination step relies on. See How to use.
After the experiment — call genotypes from the amplicon reads, deduplicated by UMI:
dgrec genotypes reads.fastq.gz reference.fasta -o genotypes.csv
or, in Python, with the mutation profile plotted:
import os
from Bio import SeqIO
data_path = dgrec.get_example_data_dir() #the example dataset that ships with the package
ref_seq = str(next(SeqIO.parse(os.path.join(data_path, 'sacB_ref.fasta'), 'fasta')).seq)
gen_list = dgrec.get_genotypes(os.path.join(data_path, 'sacB_example.fastq.gz'), ref_seq,
ignore_pos=[0, 1, 2, 138, 139, 140, 141])
fig = dgrec.plot_mutations(gen_list, ref_seq, sample_name='sacB', TR_range=[50, 119])
n reads: 1000
n_reads pass filter: 847
n_reads aligned: 824
Number of UMIs: 814
Median number of reads per UMI: 1.0
Number of genotypes: 123
The shaded region is the TR range, where DGRec mutagenesis is active. Note the enrichment of mutations at adenine positions within it — the hallmark DGRec signature.
Read the full walkthrough → for paired-end reads, the command-line options, TR recoding, and the LSTM model of the mutational profile. Every function is documented in the API reference.
Citation
If you use dgrec, please cite:
Rochette P, Lopez-Rodriguez E, Wen DJ, Régnier L, et al. Diversity-generating retroelements for programmable targeted hypermutagenesis. Nature Biotechnology (2026). doi:10.1038/s41587-026-03078-4
A separate paper describing the bioinformatics and sequence-design tools provided by this package is in preparation; once it is published, please cite both. A CITATION.cff file is included in the repository.
Metadata
Release files for dgrec-tools 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dgrec_tools-0.2.0.tar.gz | 197.9 kB | Without provenance | Details for dgrec_tools-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dgrec_tools-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dgrec_tools-0.2.0-py3-none-any.whl |
Total release size: 396.5 kB
Release files / dgrec_tools-0.2.0.tar.gz
| Download URL | dgrec_tools-0.2.0.tar.gz |
|---|---|
| Size | 197.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
806bf6a96c6cac37a2ddbd55db3323f2221827f669f34a60d436c2b2cd700855
|
|
BLAKE2b-256 checksum How to use checksums |
7a0a380ea5026dee13e583048805c509846d578b1f0813a4d346250ccf237821
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / dgrec_tools-0.2.0-py3-none-any.whl
| Download URL | dgrec_tools-0.2.0-py3-none-any.whl |
|---|---|
| Size | 198.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c51abff38c0ea05d94d8b2a34c7dabc5525777a38a3353dc3a81ddf6a99665d
|
|
BLAKE2b-256 checksum How to use checksums |
cacc6626917f6e38c6e1ae34f3860ca5138d74bc6176595b3a6a3fcabc2ece7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Security for dgrec-tools 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.