Conditional multi-domain protein sequence generation with the gLM2 biosynthetic gene cluster (BGC) diffusion decoder.
The script requires Python 3.10+ and a CUDA-capable GPU.
git clone https://github.com/TattaBio/gLM2_decoder.git
cd gLM2_decoder
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtRun the included VL-Start PKS example:
python sample_glm2.py \
--prompt-fasta examples/vl_start.fasta \
--domains-file examples/vl_start_domains.txt \
--mask-prob 0.7 \
--num-samples 10 \
--num-steps 100 \
--output-path samples.fastaUse your own protein sequence:
python sample_glm2.py \
--prompt-fasta template.fasta \
--mask-prob 0.5 \
--num-samples 10 \
--num-steps 100 \
--output-path samples.fastaRestrict redesign to a sequence range and optionally provide antiSMASH domain annotations:
python sample_glm2.py \
--prompt-fasta template.fasta \
--maskable-ranges 133:995 \
--domains AS-PKS_KS,AS-PKS_AT \
--mask-prob 0.7 \
--num-samples 10 \
--num-steps 100Ranges and protected indices are zero-based and inclusive. Sampling defaults to
temperature 0.7 and eta 0.1. By default, the number of diffusion steps equals
the number of masked tokens; use --num-steps to cap the number of model passes.
Pseudo-likelihood scoring is optional because it adds extra model passes. Add
--score to any command to score and rank the generated sequences.
TODO
Code and model weights are licensed under the CC BY-NC 4.0 license. Free for academic and research use.