You are reading the documentation for version 1.3 of ProMod3. You may also want to read the documentation for: 2.0 2.1 3.0 3.1 3.2 3.3

Backbone Score Environment

BackboneScoreEnv class

class promod3.scoring.BackboneScoreEnv(seqres)

The backbone score environment contains and handles all model-specific data used by the scorers. It is linked to a (list of) seqres (one per chain) at construction. The idea is to initialize it at the beginning of the modelling process with all known data (positions extracted from template, psipred prediction, etc). All scorers attached to that environment will see that data and can calculate scores accordingly. Scoring with this setup is a two step process:

  • Set the positions you want to score in the environment to make it available to all attached scorers
  • Call the scorers to get the desired scores

One problem that might occur is that you mess around with the environment and at some point you want to restore the original state. The BackboneScoreEnv provides a Stash / Pop mechanism to perform this task.

Parameters:seqres (str / ost.seq.SequenceHandle / list of str / ost.seq.SequenceList) – Internal SEQRES to be set (single chain or list with one per chain). Whenever setting structural data, consistency with this SEQRES is enforced.

To access parts of the environment there are two key arguments to consider:

  • chain_idx: Index of chain as it occurs in seqres (0 for single sequence)
  • start_resnum: Residue number defining the position in the SEQRES of chain with index chain_idx. The numbering starts for every chain with the value 1.
Returns:A copy of the current BackboneScoreEnv without any scorers attached
Return type:BackboneScoreEnv

Sets structural environment with which loops to be scored interact. If structural data was already set, all the existing data gets cleared first.

Parameters:env_structure (ost.mol.EntityHandle) – Structral data to be set as environment. The chains in env_structure are expected to be in the same order as the SEQRES items provided in constructor.
Raises:RuntimeError if env is inconsistent with SEQRES set in constructor. This can be because of corrupt residue numbers or sequence mismatches.
SetEnvironment(bb_list, start_resnum, chain_idx=0)

Add/update structural information in environment. If structural data for specific residues is already set, the data gets resetted for these positions.

  • bb_list (BackboneList) – Structural data to be set as environment.
  • start_resnum (int / ost.mol.ResNum) – Res. number defining the position in the SEQRES.
  • chain_idx (int) – Index of chain the structural data belongs to.

RuntimeError if sequence of bb_list is inconsistent with previously SEQRES set in constructor or when either start_resnum or chain_idx point to invalid positions in the SEQRES.

ClearEnvironment(start_resnum, num_residues, chain_idx=0)

Clears a stretch of length num_residues in the environment in chain with idx chain_idx starting from residue number start_resnum

  • start_resnum (int) – Start of stretch to clear
  • num_residues (int) – Length of stretch to clear
  • chain_idx (int) – Chain the stretch belongs to

RuntimeError when either start_resnum or chain_idx point to invalid positions in the SEQRES.


Set the psipred prediction, which is necessary to calculate some scores.

Parameters:pred (PsipredPrediction / list of PsipredPrediction) – Psipred prediction to set (one per chain).
Raises:RuntimeError if the number of predictions is inconsistent with the number of internal chains or when one of the predictions’ sizes is inconsistent with the internal SEQRES size.
AddPairwiseFunction(function, function_type)

Adds a pairwise function that can be used in ApplyPairwiseFunction().


Function index to be used in ApplyPairwiseFunction().

Return type:


ApplyPairwiseFunction(chain_idx_one, resnum_one, chain_idx_two, resnum_two, f_idx)

Define two residues to be evaluated with a given pairwise function. This data can then be used by scorers. Note that the pairs are symmetric and so there is no need to add them twice with switched residues.

  • chain_idx_one (int) – Chain index of first residue
  • resnum_one (int) – Res. number of first residue
  • chain_idx_two (int) – Chain index of second residue
  • resnum_two (int) – Res. number of second residue
  • f_idx (int) – Index of pairwise function (as returned by AddPairwiseFunction())

RuntimeError if any of the chain indices or res. numbers is invalid, the interaction partners are the same residue or when f_idx is an invalid index.

Stash(start_rnum, num_residues, chain_idx)

FILO style stashing. You can perform up to 100 stash operations to save the current state of certain stretches in the environment. This state can be restored by calling Pop(). In one stash operation you can either stash one stretch by providing integers as input or several stretches by providing lists of integers.

  • start_rnum (int / list of int) – start rnum of stretch to stash
  • num_residues (int / list of int) – length of stretch to stash
  • chain_idx (int / list of int) – chain idx of stretch to stash

Remove and apply the the last stash operation.

Returns:SEQRES that was set in constructor (one sequence per chain).
Return type:ost.seq.SequenceList

Pairwise function classes

class promod3.scoring.PairwiseFunctionType

Enumerates the pairwise function types. Possible values:

  • CA_PAIRWISE_FUNCTION - Evaluate CA atoms distances.
  • CB_PAIRWISE_FUNCTION - Evaluate CB atoms distances.
class promod3.scoring.PairwiseFunction

Base class for any pairwise function.

Returns:Score for a given pairwise distance
Return type:float
Parameters:distance (float) – Pairwise distance
class promod3.scoring.ConstraintFunction(min_dist, max_dist, values)

Inherits all functionality of PairwiseFunction. Defines a constraint function. The score for a distance between min_dist and max_dist is determined by linear interpolation assuming the first and last value exactly lying on min_dist and max_dist. For distances outside the range defined by min_dist and max_dist, the returned score is 0.0.

  • min_dist (float) – Minimal distance to be considered
  • max_dist (float) – Maximal distance to be considered
  • values (list of float) – The possible values that get returned when the distance is between min_dist and max_dist

RuntimeError if min_dist >= max_dist or when min_dist or max_dist are negative or when values contains no elements

class promod3.scoring.ContactFunction(max_dist, score)

Inherits all functionality of PairwiseFunction. Defines a simple contact function. The score value is score if distance < max_dist and 0.0 otherwise.

  • max_dist (float) – Maximal distance to be in contact
  • score (float) – Value that gets returned if in contact

Convenient construction of pairwise functions

class promod3.scoring.DiscoContainer(seqres[, function_type = CA_PAIRWISE_FUNCTION])

A container collecting structural information until it can be added in form of ConstraintFunction to a BackboneScoreEnv . The constraint functions are built after the principle of QMEANDisCo.

Parameters:aln (ost.seq.AlignmentHandle) – Alignment, where first sequence represent the initial SEQRES and the second sequence the actual structural info. The second sequence must have a view attached.
Raises:RuntimeError if number of sequences in aln is not two, the SEQRES does not match or when the second sequence in aln has no view attached.
AttachConstraints(env, chain_indices[, cluster_thresh = 0.5, gamma = 70.0])

Generates distance constraints and adds it to env. It first clusters the added sequences with a pairwise normalised sequence similarity based on BLOSUM62. It’s a hierarchical clustering with with an average distance metric and cluster_thresh as threshold to merge two clusters. Constraint functions are built for every cluster and finally merged. The influence of the per cluster constraint functions to the overall function depends on the clusters average sequence similarity to the target SEQRES. How fast this influence vanishes gets controlled by gamma. The higher it is, the faster vanishes the influence of structural info from distant clusters. The final pairwise cluster functions get then directly added to the scoring env.

  • env (BackboneScoreEnv) – The scoring env to which the constraint should be added
  • chain_indices (list of int) – Indices of chains for which the constraints should be added
  • cluster_thresh (float) – Controls the clustering behaviour at the initial stage of constraint construction
  • gamma (float) – Controls how fast the influence of constraint functions of distant clusters vanishes

RuntimeError if one of the chain_indices is invalid or the SEQRES set in env for specified chain is inconsistent with SEQRES you initialized the DiscoContainer with



Enter search terms or a module, class or function name.

Previous topic

scoring - Loop Scoring

Next topic

Backbone Scorers

You are here