This document is for OpenStructure version 2.8, the latest version is 2.9.0 !

qsscore – New QS Score Implementation

Note

This is a new implementation of QS Score, introduced in OpenStructure 2.4 and tightly integrated with the chain mapping algorithms. The previous qsscoring code that comes with Bertoni et al. is considered deprecated.

class QSEntity(ent, contact_d=12.0)

Helper object for QS-score computation

Holds structural information and getters for interacting chains, i.e. interfaces. Peptide residues are represented by their CB position (CA for GLY) and nucleotides by C3’.

Parameters:
property view

Processed structure

View that only contains representative atoms. That’s CB for peptide residues (CA for GLY) and C3’ for nucleotides.

Type:

ost.mol.EntityView

property contact_d

Pairwise distance of residues to be considered as contacts

Given at QSEntity construction

Type:

float

property chain_names

Chain names in view

Names are sorted

Type:

list of str

property interacting_chains

Pairs of chains in view with at least one contact

Type:

list of tuples

GetChain(chain_name)

Get chain by name

Parameters:

chain_name (str) – Chain in view

GetSequence(chain_name)

Get sequence of chain

Returns sequence of specified chain as raw str

Parameters:

chain_name (str) – Chain in view

GetPos(chain_name)

Get representative positions of chain

That’s CB positions for peptide residues (CA for GLY) and C3’ for nucleotides. Returns positions as a numpy array of shape (n_residues, 3).

Parameters:

chain_name (str) – Chain in view

PairDist(chain_name_one, chain_name_two)

Get pairwise distances between two chains

Returns distances as numpy array of shape (a, b). Where a is the number of residues of the chain that comes BEFORE the other in chain_names

GetMinPos(chain_name)

Get min x,y,z cooridnates for given chain

Based on positions that are extracted with GetPos

Parameters:

chain_name (str) – Chain in view

GetMaxPos(chain_name)

Get max x,y,z cooridnates for given chain

Based on positions that are extracted with GetPos

Parameters:

chain_name (str) – Chain in view

PotentialInteraction(chain_name_one, chain_name_two)

Returns True if chains potentially interact

Based on crude collision detection. There is no guarantee that they actually interact if True is returned. However, if False is returned, they don’t interact for sure.

Parameters:
  • chain_name_one (class:str) – Chain in view

  • chain_name_two (class:str) – Chain in view

class QSScorer(target, chem_groups, model, alns, contact_d=12.0)

Helper object to compute QS-score

Tightly integrated into the mechanisms from the chain_mapping module. The prefered way to derive an object of type QSScorer is through the static constructor: FromMappingResult(). Example score computation including mapping:

from ost.mol.alg.qsscore import QSScorer
from ost.mol.alg.chain_mapping import ChainMapper

ent_1 = io.LoadPDB("path_to_assembly_1.pdb")
ent_2 = io.LoadPDB("path_to_assembly_2.pdb")

chain_mapper = ChainMapper(ent_1)
mapping_result = chain_mapper.GetlDDTMapping(ent_2)
qs_scorer = QSScorer.FromMappingResult(mapping_result)
score_result = qs_scorer.Score(mapping_result.mapping)
print("score:", score_result.QS_global)

QS-score computation in QSScorer.Score() implements caching. Repeated computations with alternative chain mappings thus become faster.

Parameters:
static FromMappingResult(mapping_result)

The preferred way to get a QSScorer

Static constructor that derives an object of type QSScorer using a ost.mol.alg.chain_mapping.MappingResult

Parameters:

mapping_result (ost.mol.alg.chain_mapping.MappingResult) – Data source

property qsent1

Represents target

Type:

QSEntity

property chem_groups

Groups of chemically equivalent chains in target

Provided at object construction

Type:

list of list of str

property qsent2

Represents model

Type:

QSEntity

property alns

Alignments between chains in qsent1 and qsent2

Provided at object construction. Each alignment is accessible with alns[(t_chain,m_chain)]. First sequence is the sequence of the respective chain in qsent1, second sequence the one from qsent2.

Type:

dict with key: tuple of str, value: ost.seq.AlignmentHandle

Score(mapping, check=True)

Computes QS-score given chain mapping

Again, the preferred way is to get mapping is from an object of type ost.mol.alg.chain_mapping.MappingResult.

Parameters:
Returns:

Result object of type QSScorerResult

ScoreInterface(trg_ch1, trg_ch2, mdl_ch1, mdl_ch2)

Computes QS-score only considering one interface

This only works for interfaces that are computed in Score(), i.e. interfaces for which the alignments are set up correctly.

As all specified chains must be present, the mapping is considered complete which affects QSScorerResult.QS_global/QSScorerResult.QS_best in edge cases of no observed contacts.

Parameters:
  • trg_ch1 (str) – Name of first interface chain in target

  • trg_ch2 (str) – Name of second interface chain in target

  • mdl_ch1 (str) – Name of first interface chain in model

  • mdl_ch2 (str) – Name of second interface chain in model

Returns:

Result object of type QSScorerResult

Raises:

RuntimeError if no aln for trg_ch1/mdl_ch1 or trg_ch2/mdl_ch2 is available.

FromFlatMapping(flat_mapping)

Same as Score() but with flat mapping

Parameters:

flat_mapping (dict with str as key and value) – Dictionary with target chain names as keys and the mapped model chain names as value

Returns:

Result object of type QSScorerResult

class QSScorerResult(weighted_scores, weight_sum, weight_extra_mapped, weight_extra_all, complete_mapping)

Holds data relevant for QS-score computation. Formulas for QS scores:

- QS_best = weighted_scores / (weight_sum + weight_extra_mapped)
- QS_global = weighted_scores / (weight_sum + weight_extra_all)
-> weighted_scores = sum(w(min(d1,d2)) * (1 - abs(d1-d2)/12)) for shared
-> weight_sum = sum(w(min(d1,d2))) for shared
-> weight_extra_mapped = sum(w(d)) for all mapped but non-shared
-> weight_extra_all = sum(w(d)) for all non-shared
-> w(d) = 1 if d <= 5, exp(-2 * ((d-5.0)/4.28)^2) else

In the formulas above:

  • “d”: CA/CB-CA/CB distance of an “inter-chain contact” (“d1”, “d2” for “shared” contacts).

  • “mapped”: we could map chains of two structures and align residues in alignments.

  • “shared”: pairs of residues which are “mapped” and have “inter-chain contact” in both structures.

  • “inter-chain contact”: CB-CB pairs (CA for GLY) with distance <= 12 A (fallback to CA-CA if calpha_only is True).

  • “w(d)”: weighting function (prob. of 2 res. to interact given CB distance) from Xu et al. 2009.

property weighted_scores

weighted_scores attribute as described in formula section above

Type:

float

property weight_sum

weight_sum attribute as described in formula section above

Type:

float

property weight_extra_mapped

weight_extra_mapped attribute as described in formula section above

Type:

float

property weight_extra_all

weight_extra_all attribute as described in formula section above

Type:

float

property complete_mapping

Whether the underlying mapping of the scored assemblies is complete

In other words: If they have the same stoichiometry. This is relevant for QS_best and QS_global in case of no contacts in any of the scored entities.

Type:

bool

property QS_best

QS_best - the actual score as described in formula section above

If there are no contacts observed in any of the scored entities this score is 1.0 if we’re comparing structures with complete_mapping, 0.0 otherwise. In the example of two monomers, no contacts can be observed but they exactly match in terms of quaternary structure. Thus a perfect score. In terms of higher order structure that becomes a bit more abstract but in principle they still have the exact same quaternary structure if they match in stoichiometry but have no single contact.

Type:

float

property QS_global

QS_global - the actual score as described in formula section above

If there are no contacts observed in any of the scored entities this score is 1.0 if we’re comparing structures with complete_mapping, 0.0 otherwise. In the example of two monomers, no contacts can be observed but they exactly match in terms of quaternary structure. Thus a perfect score. In terms of higher order structure that becomes a bit more abstract but in principle they still have the exact same quaternary structure if they match in stoichiometry but have no single contact.

Type:

float

Search

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

Contents

Documentation is available for the following OpenStructure versions:

dev / 2.9.0 / (Currently viewing 2.8) / 2.7 / 2.6 / 2.5 / 2.4 / 2.3.1 / 2.3 / 2.2 / 2.1 / 2.0 / 1.9 / 1.8 / 1.7.1 / 1.7 / 1.6 / 1.5 / 1.4 / 1.3 / 1.2 / 1.11 / 1.10 / 1.1

This documentation is still under heavy development!
If something is missing or if you need the C++ API description in doxygen style, check our old documentation for further information.