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.

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.2

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.2
File Size Uploaded Provenance Actions
eqc_bio-0.1.2.tar.gz 915.6 kB Without provenance Details for eqc_bio-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 947.9 kB

Release files / eqc_bio-0.1.2.tar.gz

Download URL eqc_bio-0.1.2.tar.gz
Size 915.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d78af44b0391c65fbd36e2bf011a9f7bc37fd7475cc87e607c747ea2c37c0ccf
BLAKE2b-256 checksum
How to use checksums
486df4c34ab3f7f09ee14988445a7a78d2f6134c358cc4c204137e1591c400d1
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.2-py3-none-any.whl

Download URL eqc_bio-0.1.2-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cea8aae20c5ad063f96b304f046a022e7218667b7a7551f9ce23edd5af6512b
BLAKE2b-256 checksum
How to use checksums
100a032d4d8704c53bcbf20c96c193a4329a97fff9c5922c5a28e0dbd77bfa2c
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.2

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.2 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