Backbone Scorers¶
BackboneOverallScorer class¶
- class promod3.scoring.BackboneOverallScorer¶
Container that allows for the storage of multiple scorers identified by a key (
str
) and the computation of combined scores.Scorers need to be individually set or loaded by
LoadDefaultBackboneOverallScorer()
- Contains(key)¶
- Get(key)¶
- Returns:
Scorer with the given key (read-only access).
- Return type:
- Parameters:
key (
str
) – Key for desired scorer.- Raises:
RuntimeError
if there is no scorer with that key.
- AttachEnvironment(env)¶
- Parameters:
env (
BackboneScoreEnv
) – Link all scorers to this score environment.
- Calculate(key, start_resnum, num_residues, chain_idx=0)¶
Calculate score for one or several stretches of amino acids given the current scoring environment.
- Parameters:
key (
str
) – Key for desired scorer.start_resnum (
int
/list
ofint
) – Res. number defining the position in the SEQRES (seeBackboneScoreEnv
for indexing)num_residues (
int
/list
ofint
) – Number of residues in the stretch(es) to scorechain_idx (
int
/list
ofint
) – Index of chain the stretch(es) belongs to (seeBackboneScoreEnv
for indexing)
- Returns:
Score calculated with the desired scorer for the given stretch(es).
- Return type:
- Raises:
RuntimeError
if there is no scorer with that key or anything raised inBackboneScorer.CalculateScore()
.
- CalculateLinearCombination(linear_weights, start_resnum, num_residues, chain_idx=0)¶
Calculate linear combination of scores for one or several stretches of amino acids given the current scoring environment.
- Parameters:
linear_weights (
dict
(keys:str
, values:float
)) – Weights for each desired scorer. You can add a constant value to each score by defining a weight with key “intercept”.start_resnum (
int
/list
ofint
) – Res. number defining the position in the SEQRES (seeBackboneScoreEnv
for indexing)num_residues (
int
/list
ofint
) – Number of residues in the stretch(es) to scorechain_idx (
int
/list
ofint
) – Index of chain the stretch(es) belongs to (seeBackboneScoreEnv
for indexing)
- Returns:
Linear combination of the scores calculated with the desired scorers for the given stretch(es)
- Return type:
- Raises:
RuntimeError
if linear_weights has a key for which no scorer exists or anything raised inBackboneScorer.CalculateScore()
for any of the used scorers.
- promod3.scoring.LoadDefaultBackboneOverallScorer()¶
- Returns:
Loads or creates the default scorers accessible through following keys: “cb_packing”, “cbeta”, “reduced”, “clash”, “hbond”, “ss_agreement”,“torsion”, “pairwise”
- Return type:
BackboneScorer base class¶
- class promod3.scoring.BackboneScorer¶
Base class for all the backbone scorers listed below.
- AttachEnvironment(env)¶
- Parameters:
env (
BackboneScoreEnv
) – Link scorer to this score environment.
- CalculateScore(start_resnum, num_residues, chain_idx=0)¶
Calculates score for one or several stretches given the structural information in the attached environment. Unless otherwise noted in the scorer, a lower “score” is better!
- Parameters:
start_resnum (
int
/list
ofint
) – Res. number defining the position in the SEQRES (seeBackboneScoreEnv
for indexing)num_residues (
int
/list
ofint
) – Number of residues in the stretch(es) to scorechain_idx (
int
/list
ofint
) – Index of chain the stretch(es) belongs to (seeBackboneScoreEnv
for indexing)
- Returns:
Score for the given stretch(es).
- Return type:
- Raises:
(for most scorers)
RuntimeError
if scorer was never attached to a score environment, if scorer has never been properly initialized or if start_resnum / num_residues / chain_idx lead to invalid positions.
- CalculateScoreProfile(start_resnum, num_residues, chain_idx=0)¶
Calculates per residue scores for one or several stretches given the structural information in the attached environment.
- Parameters:
start_resnum (
int
/list
ofint
) – Res. number defining the position in the SEQRES (seeBackboneScoreEnv
for indexing)num_residues (
int
/list
ofint
) – Number of residues in the stretch(es) to scorechain_idx (
int
/list
ofint
) – Index of chain the stretch(es) belongs to (seeBackboneScoreEnv
for indexing)
- Returns:
Scores for the given stretch(es), one for each residue.
- Return type:
- Raises:
same
RuntimeError
asCalculateScore()
.
CBPackingScorer class¶
- class promod3.scoring.CBPackingScorer(cutoff, max_count)¶
Inherits all functionality of
BackboneScorer
. Evaluates pseudo energies by counting the number of other CB positions within a certain cutoff radius of the CB position of the residue to be evaluated.The scorer needs to be initialized either by loading a predefined scorer (e.g.
LoadCBPackingScorer()
) or by setting all energies (seeSetEnergy()
).- Parameters:
- Raises:
RuntimeError
if cutoff < 0 or max_count < 1.
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.- Raises:
RuntimeError
if file cannot be opened.
- SetEnergy(aa, count, energy)¶
Setup one energy value. Unless a predefined scorer is loaded, this must be called for every type of amino acids and for every count <= max_count.
- Parameters:
aa (
ost.conop.AminoAcid
) – Amino acid for which to set energy.count (
int
) – Number of surrounding CB positions for which to set energy.energy (
float
) – Energy to set for those parameters.
- Raises:
RuntimeError
if inputs are invalid
- promod3.scoring.LoadCBPackingScorer()¶
- Returns:
The default predefined CBPackingScorer (loaded from disk)
- Return type:
CBetaScorer class¶
- class promod3.scoring.CBetaScorer(cutoff, bins, seq_sep)¶
Inherits all functionality of
BackboneScorer
. Evaluates a pairwise pseudo interaction energy between CB atoms which are located within a cutoff and which are at least seq_sep residues apart. An energy is assigned to each distance using equally sized bins and distinguishing all possible pairs of amino acids.The scorer needs to be initialized either by loading a predefined scorer (e.g.
LoadCBetaScorer()
) or by setting all energies (seeSetEnergy()
).- Parameters:
- Raises:
RuntimeError
if cutoff < 0, bins < 1 or seq_sep < 1.
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.- Raises:
RuntimeError
if file cannot be opened.
- SetEnergy(aa1, aa2, bin, energy)¶
Setup one energy value. Unless a predefined scorer is loaded, this must be called for every pair of amino acids and for every bin < bins. Internal symmetry is enforced => Calling SetEnergy(aa1, aa2, bin, energy) is equivalent to calling SetEnergy(aa1, aa2, bin, energy) AND SetEnergy(aa2, aa1, bin, energy).
- Parameters:
aa1 (
ost.conop.AminoAcid
) – Amino acid for first interaction partner.aa2 (
ost.conop.AminoAcid
) – Amino acid for second interaction partner.bin (
int
) – Discrete bin describing the interaction distance.energy (
float
) – Energy to set for those parameters.
- Raises:
RuntimeError
if inputs are invalid
- DoInternalScores(do_it)¶
- Parameters:
do_it (
bool
) – Whether to include pairwise interactions between the scored residues. True by default.
- promod3.scoring.LoadCBetaScorer()¶
- Returns:
The default predefined CBetaScorer (loaded from disk)
- Return type:
ReducedScorer class¶
- class promod3.scoring.ReducedScorer(cutoff, dist_bins, angle_bins, dihedral_bins, seq_sep)¶
Inherits all functionality of
BackboneScorer
. Evaluates a pairwise pseudo interaction energy between the reduced representation of residues. Every residue gets represented by its CA position p and a directional componentv = norm(p-n_pos) + norm(p-c_pos)
. Residues with CA distance < cutoff and which are at least seq_sep residues apart are considered to be interacting. For interacting residues r1 and r2, we can define a line l between p1 and p2. The potential then considers:dist => distance between p1 and p2
alpha => angle between v1 and l
beta => angle between v2 and l
gamma => dihedral between (p1+v1,p1,p2,p2+v2)
The scorer needs to be initialized either by loading a predefined scorer (e.g.
LoadReducedScorer()
) or by setting all energies (seeSetEnergy()
).- Parameters:
cutoff (
float
) – Radius in which other CA atoms are searched.dist_bins (
int
) – Number of equally sized bins to discretize distances (range of [0, cutoff]).angle_bins (
int
) – Number of equally sized bins to discretize angles (range of [0, pi]).dihedral_bins (
int
) – Number of equally sized bins to discretize dihedrals (range of [-pi, pi]).seq_sep (
int
) – Minimal separation in sequence two residues must have to be considered.
- Raises:
RuntimeError
if cutoff < 0, dist_bins < 1, angle_bins < 1, dihedral_bins < 1 or seq_sep < 1.
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.- Raises:
RuntimeError
if file cannot be opened.
- SetEnergy(aa1, aa2, dist_bin, alpha_bin, beta_bin, gamma_bin, energy)¶
Setup one energy value. Unless a predefined scorer is loaded, this must be called for every pair of amino acids, every dist_bin < dist_bins, every alpha_bin < angle_bins, every beta_bin < angle_bins and every gamma_bin < dihedral_bins. Internal symmetry is enforced => Calling SetEnergy(aa1, aa2, dist_bin, alpha_bin, beta_bin, energy) is equivalent to calling SetEnergy(aa1, aa2, dist_bin, alpha_bin, beta_bin, energy) AND SetEnergy(aa2, aa1, dist_bin, beta_bin, alpha_bin, energy).
- Parameters:
aa1 (
ost.conop.AminoAcid
) – Amino acid for first interaction partner.aa2 (
ost.conop.AminoAcid
) – Amino acid for second interaction partner.dist_bin (
int
) – Discrete bin describing the interaction distance.alpha_bin (
int
) – Discrete bin describing the alpha angle.beta_bin (
int
) – Discrete bin describing the beta angle.gamma_bin (
int
) – Discrete bin describing the gamma dihedral.energy (
float
) – Energy to set for those parameters.
- Raises:
RuntimeError
if inputs are invalid
- DoInternalScores(do_it)¶
- Parameters:
do_it (
bool
) – Whether to include pairwise interactions between the scored residues. True by default.
- promod3.scoring.LoadReducedScorer()¶
- Returns:
The default predefined ReducedScorer (loaded from disk)
- Return type:
ClashScorer class¶
- class promod3.scoring.ClashScorer¶
Inherits all functionality of
BackboneScorer
. Calculates a simple clash score of a loop itself and with the set environment. There is no need to define any parameters here as all interaction energies are fixed (see Eq. (11) in [canutescu2003b]).- DoInternalScores(do_it)¶
- Parameters:
do_it (
bool
) – Whether to include pairwise interactions between the scored residues. True by default.
HBondScorer class¶
- class promod3.scoring.HBondScorer(min_d, max_d, min_alpha, max_alpha, min_beta, max_beta, min_gamma, max_gamma, d_bins, alpha_bins, beta_bins, gamma_bins)¶
Inherits all functionality of
BackboneScorer
. Evaluates pairwise HBond pseudo energies similar to the one defined in the Rosetta energy function. It considers the CA, C and O positions from backbone hbond acceptors in interaction with the N and H positions from the backbone hbond donors. 4 Parameters describe their relative orientation.dist => H-O distance
alpha => O-H-N angle
beta => C-N-H angle
gamma => CA-C-O-H dihedral angle
A pseudo energy function for these parameters is evaluated for three different states. State 1 for helical residues, state 2 for extended residues and state 0 for other residues. If the state of two interacting particles is the same, thats the one from which the energy is extracted. In all other cases, the energy is extracted from the 0 state.
The scorer needs to be initialized either by loading a predefined scorer (e.g.
LoadHBondScorer()
) or by setting all energies (seeSetEnergy()
).- Parameters:
min_d (
float
) – Minimal H-O distance to consider interactionmax_d (
float
) – Maximal H-O distance to consider interactionmin_alpha (
float
) – Minimal O-H-N angle to consider interactionmax_alpha (
float
) – Maximal O-H-N angle to consider interactionmin_beta (
float
) – Minimal C-N-H angle to consider interactionmax_beta (
float
) – Maximal C-N-H angle to consider interactionmin_gamma (
float
) – Minimal CA-C-O-H dihedral to consider interactionmax_gamma (
float
) – Maximal CA-C-O-H dihedral to consider interactiond_bins (
int
) – Number of equally sized bins to discretize H-O distances (range of [min_d, max_d]).alpha_bins (
int
) – Number of equally sized bins to discretize O-H-N angles (range of [min_alpha, max_alpha]).beta_bins (
int
) – Number of equally sized bins to discretize C-N-H angles (range of [min_beta, max_beta]).gamma_bins (
int
) – Number of equally sized bins to discretize CA-C-O-H angles (range of [min_gamma, max_gamma]).
- Raises:
RuntimeError
if one of the bin parameters is < 1 or a max parameter is smaller than its min counterpart.
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.- Raises:
RuntimeError
if file cannot be opened.
- SetEnergy(state, d_bin, alpha_bin, beta_bin, gamma_bin, energy)¶
Setup one energy value. Unless a predefined scorer is loaded, this must be called for every state ([0, 1, 2]), every d_bin < d_bins, every alpha_bin < alpha_bins, every beta_bin < beta_bins and every gamma_bin < gamma_bins.
- Parameters:
state (
int
) – State describing the actual secondary structure (1: helical, 2: extended, 0: other)d_bin (
int
) – Discrete bin describing the H-O distance.alpha_bin (
int
) – Discrete bin describing the O-H-N angle.beta_bin (
int
) – Discrete bin describing the C-N-H angle.gamma_bin (
int
) – Discrete bin describing the CA-C-O-H dihedral.energy (
float
) – Energy to set for those parameters.
- Raises:
RuntimeError
if inputs are invalid
- DoInternalScores(do_it)¶
- Parameters:
do_it (
bool
) – Whether to include pairwise interactions between the scored residues. True by default.
- promod3.scoring.LoadHBondScorer()¶
- Returns:
The default predefined HBondScorer (loaded from disk)
- Return type:
SSAgreementScorer class¶
- class promod3.scoring.SSAgreementScorer¶
Inherits all functionality of
BackboneScorer
. Evaluates a secondary structure agreement score. The scorer has a score for each combination of psipred prediction, its confidence and the actually occurring secondary structure in the model. In every score evaluation, the secondary structure of the loop is estimated by searching for hydrogen bonds leading to a secondary structure as defined by dssp. The hbonds are searched internally in the loop as well as in the environment.The scorer needs to be initialized either by loading a predefined scorer (e.g.
LoadSSAgreementScorer()
) or by setting scores for all possible states (seeSetScore()
).This scorer assumes that the attached environment has a psipred prediction defined (see
BackboneScoreEnv.SetPsipredPrediction()
) as soon as a score is to be calculated.Note that for this scorer a higher “score” is better! So take care when combining this to other scores, where it is commonly the other way around.
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.- Raises:
RuntimeError
if file cannot be opened.
- SetScore(psipred_state, psipred_confidence, dssp_state, score)¶
Setup a single score for a combination of states. Unless a predefined scorer is loaded, this must be called for every combination of states.
- promod3.scoring.LoadSSAgreementScorer()¶
- Returns:
The default predefined structure agreement scorer (loaded from disk)
- Return type:
TorsionScorer class¶
- class promod3.scoring.TorsionScorer(group_definitions, torsion_bins)¶
Inherits all functionality of
BackboneScorer
. Evaluates pseudo energies based on the identity of three consecutive residues and the phi/psi dihedral angles of the central residue. The first phi and last psi angle get determined with the help of the environment if set.The scorer needs to be initialized either by loading a predefined scorer (e.g.
LoadTorsionScorer()
) or by setting all energies (seeSetEnergy()
) for each group definition.- Parameters:
group_definitions (
list
ofstr
) – List of group definitions defining amino acid triplets (same style as used in theTorsionSampler
class).torsion_bins (
int
) – Number of equally sized bins to discretize the torsion angles (range of [0, 2*pi]).
- Raises:
RuntimeError
if torsion_bins < 1 or if there is a possible combination of the 20 standard amino acids not matching any entry of group_definitions
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.- Raises:
RuntimeError
if file cannot be opened.
- SetEnergy(group_idx, phi_bin, psi_bin, energy)¶
Setup one energy value. Unless a predefined scorer is loaded, this must be called for every group_idx < len(group_definitions), every phi_bin < torsion_bins and every psi_bin < torsion_bins.
- Parameters:
- Raises:
RuntimeError
if inputs are invalid
- promod3.scoring.LoadTorsionScorer()¶
- Returns:
The default predefined TorsionScorer (loaded from disk)
- Return type:
PairwiseScorer class¶
- class promod3.scoring.PairwiseScorer¶
Inherits all functionality of
BackboneScorer
. Evaluates a list of generic pairwise functions (seePairwiseFunction
). That are set in the attached scoring environment (seeBackboneScoreEnv.ApplyPairwiseFunction()
).Note that for this scorer a higher “score” is better! So take care when combining this to other scores, where it is commonly the other way around.
- DoInternalScores(do_it)¶
- Parameters:
do_it (
bool
) – Whether to include pairwise interactions between the scored residues. True by default.