Skip to main content

Protein Engineering via Exploration of an Energy Landscape

Project description

BAGEL: Protein Engineering via Exploration of an Energy Landscape

Python 3.12 License: MIT PyPI version GitHub last commit GitHub issues DOI

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.

BAGEL demo

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 available pre-print.

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:

  1. Clone the repository:
git clone https://github.com/softnanolab/bagel
  1. Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Navigate to the repository:
cd bagel
  1. 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

With PyPI Installation

python scripts/script.py

With Source Installation

uv run python scripts/script.py

To execute templates reproducibly from the technical report manuscript (within statistical noise due to the nature of Monte Carlo sampling), follow release v0.1.0, also stored on Zenodo DOI. 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 HF_MODEL_DIR to an accessible folder, where HuggingFace models will be stored.

Google Colab

A prototyping, but unscalable alterantive is to run BAGEL in Google Colab, having an 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 manuscript are included as ready-to-run Python scripts.

Contributing

For development setup, testing, and contribution guidelines, see Development Guide.

Citation

@article{lala2025bagel,
        author = {L{\'a}la, Jakub and Al-Saffar, Ayham and Angioletti-Uberti, Stefano},
        title = {BAGEL: Protein Engineering via Exploration of an Energy Landscape},
        journal = {bioRxiv},
        year = {2025},
        doi = {10.1101/2025.07.05.663138},
        url = {https://www.biorxiv.org/content/early/2025/07/08/2025.07.05.663138},
        note = {Preprint}
}

Acknowledgments

BAGEL's development was lead 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

biobagel-0.1.4.tar.gz (34.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

biobagel-0.1.4-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file biobagel-0.1.4.tar.gz.

File metadata

  • Download URL: biobagel-0.1.4.tar.gz
  • Upload date:
  • Size: 34.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for biobagel-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b956730922cda3eba8dffdeddc6b95117a92c2d5bdffe1522ffa85dfda5db3f5
MD5 c35d44c35e1b07c035f932df9cbb530b
BLAKE2b-256 7a5eeededab95ba06020d1234444ec70a12e218421a27ec4a589d0ab2ce503cf

See more details on using hashes here.

File details

Details for the file biobagel-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: biobagel-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for biobagel-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6d241ef96660dad73ee7052ad92218e62e8e180ca817edcf5354eccde015bf0a
MD5 92b8647272cc0f5100727b72623d15f1
BLAKE2b-256 bd502896995bdf53c66a6c8cc218f762f0c5f518679ee6c292eb8e9d562a1523

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page