schrodinger.application.peptide_workflow.ramachandran_bias module

Module for calculating Ramachandran torsional bias as an energy term.

This module translates Ramachandran probability distributions (phi/psi angles) into energy terms that can be used to bias peptide conformational sampling.

Uses the MolProbity Top8000 Ramachandran data from rama_z module for high-quality probability distributions.

Can handle non-standard structures by automatically detecting backbone atoms and creating pseudo-residues.

class schrodinger.application.peptide_workflow.ramachandran_bias.Torsion(i, j, k, l)

Bases: tuple

i

Alias for field number 0

j

Alias for field number 1

k

Alias for field number 2

l

Alias for field number 3

class schrodinger.application.peptide_workflow.ramachandran_bias.RamachandranAngles(phi, psi)

Bases: tuple

phi

Alias for field number 0

psi

Alias for field number 1

schrodinger.application.peptide_workflow.ramachandran_bias.find_disulfide_bonds(st)

Find all disulfide bonds (S-S) between cysteine residues.

Parameters:

st (Structure) – Structure object

Returns:

Set of residue identifiers (chain:resnum[inscode]) involved in disulfide bonds

Return type:

set

schrodinger.application.peptide_workflow.ramachandran_bias.find_thioether_bonds(st)

Find all thioether bonds (C-S) that constrain residue geometry.

Detects cyclic constraints like those in lantibiotic peptides where cysteine sulfur bonds to carbon in another residue (e.g., TRP-CYS thioether bridge).

Parameters:

st (Structure) – Structure object

Returns:

Set of residue identifiers (chain:resnum[inscode]) involved in thioether bonds

Return type:

set

schrodinger.application.peptide_workflow.ramachandran_bias.precompute_residue_types(st)

Pre-compute rama_z interpolator keys for all unique residue types.

This is called once during Peptide initialization to cache the interpolator key mapping (e.g., ‘HYP’ -> ‘transPRO’, ‘RTY’ -> ‘ALA’).

Parameters:

st (Structure) – Structure object

Returns:

Dictionary mapping residue type to interpolator key

Return type:

dict

class schrodinger.application.peptide_workflow.ramachandran_bias.RamachandranCalculator(st, interp_key_cache=None)

Bases: object

Pre-computed Ramachandran data for efficient energy calculation.

Caches all static data (phi/psi atom indices, residue types, secondary structure types, disulfide/thioether bonds, interpolators) so that energy evaluation only needs to measure dihedral angles and look up cached values.

Parameters:
  • st (Structure) – Structure object

  • interp_key_cache (dict or None) – Pre-computed mapping from residue type to interpolator key, as returned by precompute_residue_types(). Passing the cache from Peptide.rama_interp_key_cache avoids redundant computation; if None, computed internally.

__init__(st, interp_key_cache=None)
calculateEnergy(st, temperature)

Calculate total Ramachandran energy from cached data.

Parameters:
  • st (Structure) – Structure object (coordinates may have changed since init)

  • temperature (float) – Temperature in Kelvin

Returns:

Tuple of (total_energy, num_residues_scored)

Return type:

tuple

schrodinger.application.peptide_workflow.ramachandran_bias.create_ramachandran_calculator(st, interp_key_cache=None)

Create a RamachandranCalculator if the structure is suitable.

Parameters:
  • st (Structure) – Structure object

  • interp_key_cache (dict or None) – Pre-computed interpolator key mapping

Returns:

Calculator instance, or None if rama_z is unavailable or the structure lacks proper residue segmentation

Return type:

RamachandranCalculator or None

schrodinger.application.peptide_workflow.ramachandran_bias.has_proper_residue_segmentation(st)

Check if structure has proper residue segmentation.

Returns True if structure has at least 2 residues and at least one residue contains CA atoms.

Parameters:

st (Structure) – Structure object

Returns:

True if structure has 2+ residues and at least one with backbone atoms

Return type:

bool

schrodinger.application.peptide_workflow.ramachandran_bias.get_phi_psi_atoms(st, residue)

Get the atom indices for calculating phi and psi angles for a residue.

Uses the built-in getDihedralAtoms() method for simplicity and correctness.

Parameters:
  • st (Structure) – Structure object

  • residue (structure._Residue) – Residue object

Returns:

RamachandranAngles containing phi and psi Torsion namedtuples, or None if angles cannot be calculated

Return type:

RamachandranAngles or None

schrodinger.application.peptide_workflow.ramachandran_bias.calculate_phi_psi(st, residue)

Calculate phi and psi angles for a residue.

Parameters:
  • st (Structure) – Structure object

  • residue (structure._Residue) – Residue object

Returns:

Tuple of (phi, psi) in degrees, or (None, None) if cannot be calculated

Return type:

tuple

schrodinger.application.peptide_workflow.ramachandran_bias.get_ramachandran_probability(phi, psi, residue_type, ss_type=None, residue=None, peptide=None)

Look up Ramachandran probability for given phi/psi angles and residue type.

Uses MolProbity Top8000 data from rama_z module if available.

Parameters:
  • phi (float) – Phi angle in degrees

  • psi (float) – Psi angle in degrees

  • residue_type (str) – 3-letter residue code (e.g., “ALA”)

  • ss_type (SS_Type or None) – Secondary structure type (SS_Type enum)

  • residue (structure._Residue or None) – Residue object (optional, used to detect C-beta for fallback)

  • peptide (Peptide or None) – Peptide object (optional, provides cached residue type mappings)

Returns:

Probability value, or None if rama_z not available

Return type:

float or None

schrodinger.application.peptide_workflow.ramachandran_bias.probability_to_energy(probability, temperature=298.0, is_disulfide=False, is_thioether=False)

Convert Ramachandran probability to energy term.

Uses the Boltzmann relation: E = -kT * ln(P)

Parameters:
  • probability (float or None) – Probability value (0 to 1)

  • temperature (float) – Temperature in Kelvin

  • is_disulfide (bool) – Whether this residue is involved in a disulfide bond

  • is_thioether (bool) – Whether this residue is involved in a thioether bond

Returns:

Energy in kcal/mol

Return type:

float

schrodinger.application.peptide_workflow.ramachandran_bias.calculate_ramachandran_energy(st, temperature=298.0, peptide=None)

Calculate total Ramachandran torsional bias energy for a structure.

Uses MolProbity Top8000 data from rama_z if available, which includes secondary structure-dependent probabilities.

Skips structures without proper residue segmentation.

Parameters:
  • st (Structure) – Structure object

  • temperature (float) – Temperature in Kelvin for energy calculation

  • peptide (Peptide or None) – Optional Peptide object (provides pre-computed calculator)

Returns:

Total Ramachandran energy in kcal/mol

Return type:

float