Skip to main content

eqc_bio.protein_design

The eqc_bio.protein_design module provides tools for fixed-backbone protein design using quantum-inspired optimization on Dirac-3 solvers.

Overview

Fixed-backbone protein design (also known as rotamer optimization or side-chain packing) involves selecting optimal side-chain conformations (rotamers) for a given protein backbone structure to minimize the total energy of the system. The eqc_bio.protein_design package formulates this combinatorial problem as a quadratic binary optimization (QUBO) model that can be solved efficiently using Quantum Computing Inc.'s Dirac-3 solvers.

Key Components

ProteinDesignFixed

The main class ProteinDesignFixed (in fixed_backbone.py) handles:

  • Loading problem configurations from YAML files
  • Reading precomputed energy matrices (interaction energies between rotamers)
  • Constructing the QUBO Hamiltonian with linear and quadratic terms
  • Running optimization on Dirac-3 (cloud or direct) solvers
  • Iterative batch solving for larger problems using METIS graph partitioning
  • Post-processing solutions into rotamer selections and PDB structures

Configuration parameters include:

  • n_samples, relaxation schedule, photon number, quantum fluctuation coefficient
  • Energy thresholds and scaling factors (alpha, beta)
  • Support for integer vs. continuous variables and iterative refinement

Supporting Modules

  • base.py: Core ProteinDesign class with Dirac-3 execution logic and iterative batching
  • rotamers.py: Rotamer library handling (Dunbrack, OSPREY formats), chi angle extraction, library parsing and validation
  • sidechains.py: Side-chain heavy-atom construction from χ angles using ideal geometry
  • viewer.py: PDB building (build_designed_pdb), visualization (view_pdb), backbone dihedrals and rotamer angle utilities

Usage

Typical workflow:

  1. Prepare a config YAML pointing to an energy matrix CSV and expected solution
  2. Instantiate ProteinDesignFixed(config_file, solver)
  3. Call run() to solve and obtain design DataFrame
  4. Use get_rotamer_angles() and build_pdb() to generate output structures

Example scripts are provided in scripts/protein_design_fixed_backbone.py and scripts/protein_design_expected_pdb.py.

Building and Viewing Designed Structures

A solution assigns a rotamer such as MET-3 (the third MET rotamer) to each designed position. The structure tools turn that into a PDB in three steps:

  1. Rotamer angles: look up the χ angles of each selected rotamer in the rotamer library the energy matrix was generated with.
  2. PDB building: keep the template's backbone atoms (N, CA, C, O, OXT) at each designed position, rename the residue, and build its side-chain heavy atoms from the χ angles. Other residues are copied unchanged.
  3. Viewing: show the PDB in Jupyter with py3Dmol or nglview.

Configuration

The structure tools read these optional keys from the config YAML:

template_pdb: data/1MJC/1MJC.pdb   # backbone the energy matrix was built on
rotamer_library: null              # null = OSPREY Lovell default, or a path to a library file
rotamer_library_format: osprey     # osprey (OSPREY .dat, e.g. Lovell) or dunbrack (Dunbrack bbdep file)
position_numbering: index          # index (1-based residue order in the file) or resseq (PDB residue number)
  • template_pdb is needed to build or view a PDB, and also for a Dunbrack library.
  • rotamer_library must be the library the energy matrix was generated with, because rotamer numbers index into it. The rotamer names in the matrix are checked against the library's rotamer counts. A name that exceeds the library's count raises an error, and a residue type that uses fewer rotamers than the library has gives a warning.
  • position_numbering: index matches how OSPREY energy matrices number positions. Use resseq when positions are PDB residue numbers.

The energy thresholds shape the Hamiltonian sent to the device:

max_energy_threshold: 10.0  # drop rotamers whose linear energy is above this
max_energy: 10.0            # cap on the linear energies kept
max_pair_energy: 80.0       # optional cap on pair energies; defaults to max_energy
  • Pair energies above the cap are lowered to it. A cap well above alpha_default keeps clashes costly; a low cap can make a clashing pair look better than the rotamers that avoid it.
  • If the thresholds would remove every rotamer at a position, its lowest-energy rotamer is kept, with a warning, so every position is designed.
  • Raising max_energy_threshold keeps more rotamers, so the problem grows. If the expected solution uses a rotamer the thresholds removed, its energy is reported as unavailable on the thresholded Hamiltonian.

Rotamer Libraries

  • Lovell (default): the Lovell "Penultimate" library as distributed with OSPREY (LovellRotamer.dat). It is downloaded from a pinned OSPREY commit on first use and cached in ~/.eqc_bio/rotamers (set EQC_BIO_CACHE to use another directory).
  • Dunbrack (backbone-dependent): set rotamer_library_format: dunbrack and give a local copy of the Dunbrack bbdep file by path, since the library is not redistributable. It is read the way OSPREY reads it (10° φ/ψ bins, 0.001 probability cutoff, no PRO rotamers), so rotamer numbers match OSPREY matrices. Each position's φ/ψ is measured from template_pdb. The energy matrix must use position-prefixed rotamer names such as 4-MET-3.

With ProteinDesignFixed

from eqc_bio.protein_design import ProteinDesignFixed

obj = ProteinDesignFixed(config_file="config_files/config_file_1MJC.yml", solver=solver)
obj.run()

angles = obj.get_rotamer_angles()                    # position, residue, rotamer, chi_angles
pdb_str = obj.build_pdb(output_path="output/designed_1MJC.pdb")
obj.view()                                           # in Jupyter; designed side chains drawn as sticks

Each method uses the design from the last run(), or a design DataFrame (columns position and selected_rotamer) passed as design_df. load_expected_design() returns the expected solution in that form, so its structure can be built without running a solver:

cd scripts
python protein_design_expected_pdb.py config_files/config_file_1MJC.yml   # writes output/expected_1MJC.pdb

view(viewer="nglview") uses nglview instead of py3Dmol. Neither viewer is a required dependency. Install both with the viewer extra (pip install "eqc-bio[viewer]"), or install the one you need (pip install py3Dmol or pip install nglview).

Standalone Functions

The same steps are available as functions that take plain data, so angles or structures from other sources can be used at any step:

from eqc_bio.protein_design import get_rotamer_angles, build_designed_pdb, view_pdb

angles = get_rotamer_angles(design_df)               # default Lovell library
pdb_str = build_designed_pdb("data/1MJC/1MJC.pdb", angles, output_path="out.pdb")
view_pdb(pdb_str, highlight=[4, 6])                  # PDB residue numbers to draw as sticks
  • get_rotamer_angles(design, rotamer_library=None, template_pdb=None, position_numbering="index", library_format="osprey"): χ angles for each selected rotamer. A Dunbrack library also needs template_pdb.
  • build_designed_pdb(template_pdb, rotamer_angles, output_path=None, position_numbering="index"): returns the PDB as a string and writes it if output_path is given. A position missing from the template raises ValueError.
  • view_pdb(pdb_str, viewer="py3Dmol", highlight=None): returns a py3Dmol or nglview widget.
  • get_backbone_dihedrals(template_pdb, position_numbering="index"): {position: (phi, psi)} in degrees, with NaN where an atom is missing, such as at chain ends.
  • resolve_rotamer_library, load_rotamer_library, download_rotamer_library, parse_dunbrack_library, check_rotamer_counts and get_chi_angles give lower-level access to the rotamer libraries.

Applications

  • Computational protein engineering
  • Designing stable mutants or novel sequences on fixed backbones
  • Benchmarking quantum-inspired solvers on NP-hard bioinformatics problems

(C) Quantum Computing Inc., 2026.

Metadata

Release files for eqc-bio 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eqc-bio 0.1.3
File Size Uploaded Provenance Actions
eqc_bio-0.1.3.tar.gz 917.8 kB Without provenance Details for eqc_bio-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eqc-bio 0.1.3
File Interpreter ABI Platform Actions
eqc_bio-0.1.3-py3-none-any.whl Python 3 none any Details for eqc_bio-0.1.3-py3-none-any.whl

Total release size: 950.8 kB

Release files / eqc_bio-0.1.3.tar.gz

Download URL eqc_bio-0.1.3.tar.gz
Size 917.8 kB
Tags Source
SHA-256 checksum
How to use checksums
325d40543bb2c537e5ef76890f908ce542c7c1c8659b0bc6dc45dd8ce2ad349b
BLAKE2b-256 checksum
How to use checksums
a055849adc344d81349a86739aa244fc61238ef40ae086919a4d97d9a3d03d0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release files / eqc_bio-0.1.3-py3-none-any.whl

Download URL eqc_bio-0.1.3-py3-none-any.whl
Size 33.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8574ab20b775a7ab536067256cc2fc6c4333166341270e7efc4d087728872eb
BLAKE2b-256 checksum
How to use checksums
b3d7d8b1439ac9b1c650648f8ad567f6880aca51142db6546630731dc9f9cb5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Security for eqc-bio 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page