This code implements a Quality-Diversity Algorithm for binder design with ColabDesign.
The implementation uses a GridArchive with discrete binning optimized for protein sequences:
- Sequence length: One bin per integer length (categorical variable)
- Amino acid composition: 3D binning over hydrophobic, polar, and charged percentages (other percentage derived as 1 - sum)
- Niche count:
n_lengths × (category_bins)³— typical configurations yield 150-700 niches
- Fitness: Negative AlphaFold loss (lower loss = higher fitness)
- Diversity: Maintained through amino acid category composition and sequence length
- Operators: Mutation (position-wise AA substitution) and crossover (chunk-based recombination with pLDDT-guided selection)
- All loss terms are length-normalized to prevent bias toward short/long sequences
- Model state (weights, inputs) is preserved across sequence evaluations
- Per-niche elite structures are automatically saved and updated when improved
- Full per-term loss breakdown logged in JSONL format for post-hoc analysis
af_model.design_mapelites(
iters=100,
num_elites=700, # higher count enables finer category resolution
mutation_rate=5,
num_sequences=200,
min_len=20,
max_len=40,
experiment_name="my_experiment",
init_sampling_strategy="stratified" # or "random"
)Output:
experiment_name/all_seq.jsonl: Full loss breakdown per evaluated sequenceexperiment_name/elite_structure/: Best PDB structure per niche (auto-updated)experiment_name/final_elites.jsonl: Final archive with complete metrics
If you encounter OpenBLAS errors:
set -x OPENBLAS_NUM_THREADS 1
set -x OMP_NUM_THREADS 1
set -x MKL_NUM_THREADS 1export OPENBLAS_NUM_THREADS=1
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1Original ColabDesign README
- P(structure | sequence)
- P(sequence | structure)
- ProteinMPNN
- [WIP] TrMRF
- P(sequence)
- [WIP] MSA_transformer
- [WIP] SEQ - (GREMLIN, mfDCA, arDCA, plmDCA, bmDCA, etc)
- P(structure)
- See our Discord channel!
- Sergey Ovchinnikov @sokrypton
- Shihao Feng @JeffSHF
- Justas Dauparas @dauparas
- Weikun.Wu @guyujun (from Levinthal.bio)
- Christopher Frank @chris-kafka