Global score calculation

Cross-correlation function (CCC)

The most commonly-used method of scoring the goodness-of-fit.

The following example shows how to calculate the CCC score between two Map instances:

from TEMPy.ScoringFunctions import ScoringFunctions
from TEMPy.MapParser import MapParser

scorer = ScoringFunctions()
blurrer = StructureBlurrer()

target_map=MapParser.readMRC(map_filename) #read target map
structure_instance=PDBParser.read_PDB_file('structure_id','filename')
probe_map = blurrer.gaussian_blur_real_space(structure_instance, target_map_resolution,densMap=target_map)

scorer.CCC_map(probe_map,target_map,probe_contour_threshold,target_contour_threshold)

NOTE An example script is provided (Calculate_scores.py). Inputs: [-m mapfile] [-p pdbfile] [-r map_resolution] [-t map_contour (optional)][–help help]. Use -m1 and -m2 for two maps, with -r1 and -r2 for their resolutions.

CCC can be calculated globally (mode 1) or locally (mode 3). Also, the inclusion of mean difference in calculation is optional. Look at CCC_map function for more details

Mutual information score (MI)

The following example shows how to calculate the MI score:

from TEMPy.ScoringFunctions import ScoringFunctions
from TEMPy.MapParser import MapParser

scorer = ScoringFunctions()

target_map=MapParser.readMRC(map_filename_target)
probe_map=MapParser.readMRC(map_filename_probe)

score_MI=scorer.MI(probe_map,target_map,probe_contour_threshold,target_contour_threshold)
print score_MI

NOTE An example script is provided (Calculate_scores.py). MI can be calculated globally (mode 1) or locally (mode 3).

Normalized Mutual Information is implemented following Studholme et al. 1999. An example script is provided (Calculate_nmi.py).

Normal vector score (NV)

Calculates the average angular difference between the vectors representing the surface of the target and probe maps. The score goes from 1 to 0, 1 indicates maximum, i.e. there is no difference in the direction of all corresponding normal vectors between the target and probe maps. The normal vector score does not rely heavily on the absolute (coordinate) positions of the calculated surface voxels, but rather on the density gradients at these points.

It can be used in conjunction with Sobel Filter.

The following lines show how to calculate the NV score:

scorer.normal_vector_score(target_map, probe_map, first_bound, second_bound)

scorer.normal_vector_score(target_map,probe_map, first_bound, second_bound,Filter='Sobel')

An example script is provided (Calculate_scores.py).

Laplacian-filtered CCC (LAP)

The following example shows how to calculate the Laplacian cross-correlation score between two Map instances:

scorer.laplace_CCC(mapprobe,maptarget)

Envelope score (ENV)

The fastest of the available scores and so it could be used to screen possible fits in large assemblies.

The following example shows how to calculate the ENV score:

from TEMPy.StructureParser import PDBParser
from TEMPy.MapParser import MapParser

scorer = ScoringFunctions()

target_map=MapParser.readMRC(target_map) #read target map
structure_instance=PDBParser.read_PDB_file('structure_id','filename')

min_thr=target_map.get_min_threshold(structure_instance.get_prot_mass_from_atoms(), target_map.min(), \
    target_map.max()) #minimum density value based on protein molecular weight.
score_ENV=scorer.envelope_score(target_map, min_thr, structure_instance,norm=True)
print score_ENV

NOTE The correct definition of the volume threshold can affect the performance of this score