Protein Engineering via Exploration of an Energy Landscape
Project description
BAGEL: Protein Engineering via Exploration of an Energy Landscape
BAGEL is a model-agnostic, modular, fully customizable Python framework for programmable protein design.
The package formalizes the protein design task as an optimization (sampling) over an energy landscape.
The BAGEL package is made up of several components that need to be specified to form a protein engineering task:
| Component | Description | Examples |
|---|---|---|
EnergyTerms |
Define specific design constraints as terms in the energy function. | TemplateMatchEnergy, PLDDTEnergy, HydrophobicEnergy |
Oracles |
Provide information (often via ML models) to compute optimization/sampling metrics. Oracles are typically wrappers around models from boileroom. |
ESMFold, ESM-2 |
Minimizers |
Algorithms that sample or optimize sequences to find optima or diverse variants. | Monte Carlo, SimulatedTempering, SimulatedAnnealing |
MutationProtocols |
Methods for perturbing sequences to generate new candidates. | Canonical, GrandCanonical |
For more details, consult the published paper.
Installation
From PyPI (Recommended)
The easiest way to install BAGEL is through PyPI:
pip install biobagel
Optional Extras:
- For local protein model execution (requires GPU):
pip install biobagel[local]
- For development (testing, linting, documentation):
pip install biobagel[dev]
From Source
If you want to install from source or contribute to development:
- Clone the repository:
git clone https://github.com/softnanolab/bagel
- Install
uv(if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh
- Navigate to the repository:
cd bagel
- Install the environment:
uv sync
Optional Extras:
- For local protein model execution (requires GPU):
uv sync --extra local
- For development (testing, linting, documentation):
uv sync --extra dev
- For all extras:
uv sync --all-extras
Usage
Run any of the provided example scripts to get started. For instance, to design a simple binder:
# With PyPI installation
python scripts/binders/simple_binder.py
# With source installation
uv run python scripts/binders/simple_binder.py
To execute templates reproducibly from the published paper (within statistical noise due to the nature of Monte Carlo sampling), follow release v0.1.0, also stored on Zenodo . Otherwise, use the most recent
biobagel distribution.
Oracles
One can either run Oracles locally, or remotely.
use_modal=True: Run Oracles on Modal. Using the boileroom package, running remotely is made seamless and does not require installing any dependencies. However, you need to have credits to use Modal.use_modal=False: Run Oracles locally through boileroom. You need a GPU with suitable memory requirements.
To use Modal, one needs to create an account and authenticate through:
modal token new
You also need to set MODEL_DIR to an accessible folder, where deep learning models will be stored (i.e. cached).
Note on cache location and persistence:
- By default, examples may resolve
MODEL_DIRto an XDG-compliant cache directory such as~/.cache/bagel/models(or the path in$XDG_CACHE_HOME). This directory is user-writable and persists across runs. - The cache is not automatically cleaned by the application. If you wish to reclaim disk space, remove models manually (e.g.,
rm -rf ~/.cache/bagel/models) or configure your own housekeeping policy. Advanced users on Linux can usesystemd-tmpfilesrules per their environment.
Google Colab
A prototyping, but unscalable alternative is to run BAGEL in Google Colab, having access to a T4 processing unit for free. See this notebook, which includes the installation, and the template script for simple binder.
Examples
Templates and example applications from the paper are included as ready-to-run Python scripts. For a case study on enzyme miniaturization using PLM embeddings, see the mini-enzymes scripts.
Contributing
For development setup, testing, and contribution guidelines, see Development Guide.
Citation
@article{Lala_2025,
title={BAGEL: Protein engineering via exploration of an energy landscape},
volume={21},
ISSN={1553-7358},
url={http://dx.doi.org/10.1371/journal.pcbi.1013774},
DOI={10.1371/journal.pcbi.1013774},
number={12},
journal={PLOS Computational Biology},
publisher={Public Library of Science (PLoS)},
author={Lála, Jakub and Al-Saffar, Ayham and Angioletti-Uberti, Stefano},
editor={Singh, Amar},
year={2025},
month=dec,
pages={e1013774}
}
Acknowledgments
BAGEL's development was led by Jakub Lála, Ayham Al-Saffar, and Dr Stefano Angioletti-Uberti at Imperial College London. We thank Shanil Panara, Dr Daniele Visco, Arnav Cheruku, and Harsh Agrawal for helpful discussions. We also thank Hie et al. 2022, whose work inspired the creation of this package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file biobagel-0.1.13.tar.gz.
File metadata
- Download URL: biobagel-0.1.13.tar.gz
- Upload date:
- Size: 34.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a30449322fe39c601a234966363d5774dbb9384c99787267a49d46158de00e7b
|
|
| MD5 |
e4c41e0bb23e1aa1b2caf83599b02111
|
|
| BLAKE2b-256 |
a1a8fe97d0911f16ea92f574b0f5031e7f8ec2fb0dbf8fb4c26459622d71e1d4
|
File details
Details for the file biobagel-0.1.13-py3-none-any.whl.
File metadata
- Download URL: biobagel-0.1.13-py3-none-any.whl
- Upload date:
- Size: 59.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fcf082dc7694cef90e81fb283400ea380fe83a5efb8ddbccfc2c8acd72a0f1a
|
|
| MD5 |
622beb4d371148a25a3deba003fb6329
|
|
| BLAKE2b-256 |
8118d2417a03b0957e105b0c5cae254478bcc0a08d877c5ee348721a21afe347
|