Benchmark for uncertainty quantification (UQ) in protein engineering.
If you use this code, please cite the following manuscript:
@article{protein-uq,
title={Benchmarking Uncertainty Quantification for Protein Engineering},
author={Greenman, Kevin P. and Amini, Ava P. and Yang, Kevin K.},
journal={TBD},
doi={TBD},
year={2023}
}
- Install Anaconda or Miniconda if you have not yet done so.
conda install -c conda-forge mamba
(optional, but recommended, if you do not already havemamba
installed)git clone git@github.com:microsoft/protein-uq.git
cd protein-uq
mamba env create -f environment.yml
orconda env create -f environment.yml
(mamba
is recommended for faster installation)conda activate protein-uq
cd data
for d in {aav,gb1,meltome}; do (cd $d; unzip splits.zip); done
We used the FLIP repository to generate ESM embeddings for our models. The following commands can be used to reproduce the embeddings used in this work:
cd ..
(to leave theprotein-uq
directory)git clone --recurse-submodules git@github.com:J-SNACKKB/FLIP.git
(--recurse-submodules
is required to clone the ESM submodule of the FLIP repo)cd splits
for d in {aav,gb1,meltome}; do (cd $d; unzip splits.zip); done
cd ../baselines
wget https://dl.fbaipublicfiles.com/fair-esm/models/esm1b_t33_650M_UR50S.pt
(this file is 7.3 GB)wget https://dl.fbaipublicfiles.com/fair-esm/regression/esm1b_t33_650M_UR50S-contact-regression.pt
flip_esm_embedding_commands.sh
- This script contains the commands used to generate the ESM embeddings with train-val-test splits for the 8 tasks used in this work. These commands should be run from thebaselines/
directory of the FLIP repository, and theprotein-uq
conda env must be activated. Each command will take a while.
The embeddings will be saved in the FLIP/baselines/embeddings/
directory. Pre-computed embeddings for the AAV landscape can also be downloaded from Zenodo.
A list of commands to perform all training and inference for our models in series is provided in src/models/train_all_commands_series.sh
. The following is an example command:
python train_all.py --split gb1_1 --model ridge --representation ohe --uncertainty ridge --dropout 0.0 --scale --seed 0
In practice, we used the LLMapReduce command on the MIT SuperCloud to make the most efficient use of resources using the cluster's scheduler and run our jobs in parallel. Original LLMapReduce
commands are provided in src/models/LLMapReduce_commands.txt
.
A list of commands to perform all of our active learning experiments is provided in src/active_learning/active_learning_commands_series.sh
. The following is an example command:
python active_learning.py --split gb1_1 --model ridge --representation esm --uncertainty ridge --scale --num_folds 3 --al_strategy random --num_al_loops 5 --al_topk 100 --mean --dropout 0.0
In practice, we used the LLMapReduce command on the MIT SuperCloud to make the most efficient use of resources using the cluster's scheduler and run our jobs in parallel. Original LLMapReduce
commands are provided in src/active_learning/LLMapReduce_commands.txt
.
The following notebooks provided in the notebooks/
directory can be used to reproduce the figures and tables in the manuscript:
plot_results_1.ipynb
: Figures 2, 3, S1, S2, S4; Tables S1-S22plot_results_2.ipynb
: Figures 4, S3plot_results_active_learning.ipynb
: Figures 5, S5-S57
These notebooks require output files in the src/models/results/
and src/active_learning/al_results/
directories, which can be reproduced using the commands above.
The Jupyter notebook at notebooks/example.ipynb
provides an example of how to train a model and make predictions with uncertainty quantification.
Open bug reports and ask questions on GitHub issues. See SUPPORT for details.
This project is licensed under the terms of the MIT license. See LICENSE for additional details.
See CONTRIBUTING.
See SECURITY.