Skip to main content

Definition

The template match energy measures the structural deviation from a reference template. It supports two modes: RMSD mode (default, distogram_separation=False): ERMSD=RMSD(XG,Xtemplate)E_{\mathrm{RMSD}} = \mathrm{RMSD}(\mathbf{X}_G, \mathbf{X}_{\mathrm{template}}) Distogram mode (distogram_separation=True): Edistogram=1Npairsα,βGdαβdαβtemplateE_{\mathrm{distogram}} = \frac{1}{N_{\mathrm{pairs}}} \sum_{\alpha,\beta \in G} \left| d_{\alpha\beta} - d_{\alpha\beta}^{\mathrm{template}} \right|
  • XG\mathbf{X}_G are the atom positions of the selected residues after optimal superposition
  • Xtemplate\mathbf{X}_{\mathrm{template}} are the template atom positions
  • dαβd_{\alpha\beta} and dαβtemplated_{\alpha\beta}^{\mathrm{template}} are pairwise distances in the structure and template, respectively

Parameters

oracle
Oracle
required
The oracle to use for the energy term.
template_atoms
AtomArray
required
An array of atoms that specify the desired positions of the structure.
residues
list[Residue]
required
Which residues in the structure to compare to the template.
backbone_only
bool
default:"False"
Whether to only consider backbone atoms in the template and structure. Considers all atoms by default.
distogram_separation
bool
default:"False"
Whether structure - template separation is measured by taking the root mean square of the difference between the two pairwise distance matrices. By default, the root mean square of the difference in positions is used instead.
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 bagel as bg
import biotite.structure.io as strucio

# Load a template structure from a PDB file
template_atoms = strucio.load_structure("template.pdb")

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

# RMSD mode (default): minimize positional deviation from template
rmsd_energy = bg.energies.TemplateMatchEnergy(
    oracle=esmfold,
    template_atoms=template_atoms,
    residues=residues,
    backbone_only=True,
    weight=1.0,
)

# Distogram mode: minimize pairwise-distance deviation from template
distogram_energy = bg.energies.TemplateMatchEnergy(
    oracle=esmfold,
    template_atoms=template_atoms,
    residues=residues,
    distogram_separation=True,
    weight=1.0,
)

# Add to a state
state = bg.State(
    chains=[chain],
    energy_terms=[rmsd_energy],
    name="my_state",
)