Scoring functions

Many scores are simply functions of an experimental map and a simulated one, such as CCC (cross correlation coefficient) and MI (mutual information).

>>> from TEMPy.protein.structure_parser import PDBParser
>>> from TEMPy.maps.map_parser import MapParser
>>> from TEMPy.protein.scoring_functions import ScoringFunctions
>>> from TEMPy.protein.structure_blurrer import StructureBlurrer
>>>
>>> model = PDBParser.read_PDB_file("1CS4", "../tests/test_data/1CS4.pdb")
>>> exp_map = MapParser.readMRC("../tests/test_data/1CS4.mrc")
>>> map_resolution = 8.0
>>>
>>> blurrer = StructureBlurrer(with_vc=True)  # use fast real-space blurring
>>> sim_map = blurrer.gaussian_blur_real_space(
...     model,
...     map_resolution,
...     exp_map
... )
>>>
>>> scorer = ScoringFunctions()
>>> ccc_score = scorer.CCC(exp_map, sim_map)
>>> mi_score = scorer.MI(exp_map, sim_map)

The envelope score is an example of a model/map score. It calculates the fraction of atoms which are within the boundary density.

>>> from TEMPy.protein.structure_parser import PDBParser
>>> from TEMPy.maps.map_parser import MapParser
>>> from TEMPy.protein.scoring_functions import ScoringFunctions
>>>
>>> model = PDBParser.read_PDB_file("1CS4", "../tests/test_data/1CS4.pdb")
>>> exp_map = MapParser.readMRC("../tests/test_data/1CS4.mrc")
>>>
>>> scorer = ScoringFunctions()
>>> boundary = 0.1
>>> envelope_score = scorer.envelope_score(exp_map, boundary, model)

A recent addition is a new faster SMOC score which uses dynamic programming to speed up calculations.

>>> from TEMPy.protein.structure_parser import PDBParser
>>> from TEMPy.maps.map_parser import MapParser
>>> from TEMPy.protein.scoring_functions import FastSMOC
>>> from TEMPy.protein.structure_blurrer import StructureBlurrer
>>>
>>> model = PDBParser.read_PDB_file("1CS4", "../tests/test_data/1CS4.pdb")
>>> exp_map = MapParser.readMRC("../tests/test_data/1CS4.mrc")
>>> map_resolution = 8.0
>>>
>>> scorer = FastSMOC(model, exp_map, map_resolution)
>>> window_size = 11
>>> chain_a_scores = scorer.score_chain_contig('A', window_size)

To learn more about the different scores available, refer to the API reference: Link