Skip to main content

Definition

The secondary structure energy is the fraction of selected residues whose assigned secondary structure does not match the target. ESS=1NGαGI[SSαSStarget]E_{\mathrm{SS}} = \frac{1}{N_G} \sum_{\alpha \in G} \mathbb{I}[\mathrm{SS}_\alpha \neq \mathrm{SS}_{\mathrm{target}}]
  • I\mathbb{I} is the indicator function (1 if the condition is true, 0 otherwise)
  • SSα\mathrm{SS}_\alpha is the secondary structure assignment for residue α\alpha
  • SStarget\mathrm{SS}_{\mathrm{target}} is the target secondary structure (alpha-helix, beta-sheet, or coil)
  • NGN_G is the number of residues in the group GG

Parameters

oracle
Oracle
required
The oracle to use for the energy term.
residues
list[Residue]
required
Which residues to include in the calculation.
target_secondary_structure
str
required
Which secondary structure type to drive towards. Options are ‘alpha-helix’, ‘beta-sheet’, or ‘coil’.
inheritable
bool
default:"True"
If a new residue is added next to a residue included in this energy term, this dictates whether that new residue could then be added to this energy term.
weight
float
default:"1.0"
The weight of the energy term.
name
str | None
default:"None"
Optional name to append to the energy term name.

Methods

compute

Parameters
oracles_result
OraclesResultDict
required

Example

import numpy as np
import bagel as bg

# Create a 190-residue chain
sequence = np.random.choice(list(bg.constants.aa_dict.keys()), size=190)
residues = [bg.Residue(name=aa, chain_ID="A", index=i, mutable=True) for i, aa in enumerate(sequence)]

# Create the folding oracle
esmfold = bg.oracles.ESMFold()

# Define groups of residues that should form beta-sheets
groups = [residues[(i * 50) + 5 : (i * 50) + 35] for i in range(4)]

secondary_structure = bg.energies.SecondaryStructureEnergy(
    oracle=esmfold,
    residues=groups,
    target_secondary_structure="beta-sheet",
    weight=1.0,
)

# Add to a state
state = bg.State(
    chains=[bg.Chain(residues)],
    energy_terms=[secondary_structure],
    name="my_state",
)