Scoring Functions

class ScoringFunctions.ScoringFunctions[source]

A class implementing various scoring functions used in density fitting. Reference: Vasishtan and Topf (2011) Scoring functions for cryoEM density fitting. J Struct Biol 174:333-343.

CCC(map_target, map_probe)[source]

Calculate cross-correlation between two Map instances.

Arguments:
map_target, map_probe
EMMap instances to compare.
Return:
CCC score
CCC_map(map_target, map_probe, map_target_threshold=0.0, map_probe_threshold=0.0, mode=1, meanDist=False, cmode=True)[source]

Calculate cross-correlation between two Map instances, for the overlap (3), contoured (2) or complete map (1).

Arguments:
map_target, map_probe
EMMap instances to compare.
map_target_threshold,map_probe_threshold
EMMap threshold if not given, use calcualte_map_threshold to calculate map_target_threshold and map_probe_threshold
mode
3. calculation on the mask 2. calculation on contoured maps 1. calculation on complete map
meanDist
True if the deviation from mean needs to be calculated
LSF(map_target, map_probe)[source]

Calculate least-squares between two Map instances.

Arguments:
map_target, map_probe
EMMap instances to compare.
Return:
least-squares value
MI(map_target, map_probe, map_target_threshold=0.0, map_probe_threshold=0.0, mode=1, layers1=None, layers2=None, weight=False, cmode=True)[source]

Calculate the mutual information score between two Map instances.

Arguments:
map_target, map_probe
EMMap instances to compare.
map_target_threshold, map_probe_threshold
Thresholds used for contouring
mode
1. use complete map for calculation 3. use overlap region for calculation
layers1, layers2
Number of layers used to bin the maps. Default is 20 as in Shatsky et al., 2008.
Return:
MI score
SCCC(map_target, resolution_densMap, sigma_map, structure_instance, rigid_body_structure, write=False, c_mode=True)[source]

Calculate Segment based cross-correlation from Pandurangan et al. 2013,J Struct Biol. 2013 Dec 12 It is a local CCC around a selection of atoms.

Arguments:

map_target
Target Map Instance.
resolution_densMap
Parameter need for Structure Blurrer. Resolution of the target map.
sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

structure_instance
Structure instance to compare
rigid_body_structure
Rigid-body Structure instance.
. Return:
SCCC score
SCCC_LAP(map_target, resolution_densMap, sigma_map, structure_instance, rigid_body_structure, write=False)[source]

Calculate Segment based cross-correlation from Pandurangan et al. 2013,J Struct Biol. 2013 Dec 12 It is a local CCC around a selection of atoms.

Arguments:

map_target
Target Map Instance.
resolution_densMap
Parameter need for Structure Blurrer. Resolution of the target map.
sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

structure_instance
Structure instance to compare
rigid_body_structure
Rigid-body Structure instance.
. Return:
SCCC score
SCCC_MI(map_target, resolution_densMap, sigma_map, structure_instance, rigid_body_structure, write=False)[source]

Calculate Segment based cross-correlation from Pandurangan et al. 2013,J Struct Biol. 2013 Dec 12 It is a local CCC around a selection of atoms.

Arguments:

map_target
Target Map Instance.
resolution_densMap
Parameter need for Structure Blurrer. Resolution of the target map.
sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

structure_instance
Structure instance to compare
rigid_body_structure
Rigid-body Structure instance.
. Return:
SCCC score
SMOC(map_target, resolution_densMap, structure_instance, win=11, rigid_body_file=None, sigma_map=0.225, write=False, c_mode=True)[source]

Calculate Local cross correlation (Mander’s Overlap) It is a local Overlap Coefficient calculated on atoms in sliding residue windows along the chain.

Arguments:

map_target
Target Map Instance.
resolution_densMap
Parameter need for Structure Blurrer. Resolution of the target map.
structure_instance
Model structure instance.
win
Overlapping Window length to calculate the score
rigid_body_file
Rigid-body file.
sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999); 0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

Return:
Dictionary of smoc scores for residues in the chain
chamfer_distance(map_target, map_probe, primary_boundary, secondary_boundary, kdtree=None)[source]

Calculate the chamfer distance Score between two Map instances. NOT RACCOMANDED.

Arguments:
map_target, map_probe
EMMap instances to compare.
primary_boundary
is the value returned by get_primary_boundary for map_probe
secondary_boundary
is the value returned by get_second_boundary for map_probe
kdtree
If set True it is possible to choose between the option of kdtree in numpy The one that is py-based is a better choice.
envelope_score(map_target, primary_boundary, structure_instance, norm=True)[source]

Calculate the envelope score between a target Map and a Structure Instances.

Arguments:
map_target
Target Map Instance.
primary_boundary
Value specified is calculated with primary_boundary of the map object.
structure_instance
Structure Instance to compare.
Return:
Envelope score
envelope_score_map(map_target, map_probe, map_target_threshold=0, map_probe_threshold=0, norm=True)[source]

Calculate the envelope score between two Map instance using numoy array.

Arguments:
map_target, map_probe
EMMap instances to compare.
map_target_threshold,map_probe_threshold
EMMap threshold use calcualte_map_threshold to calculate map_target_threshold and map_probe_threshold.
Return:
Envelope score
get_partial_DLSF(num_of_points, map_target, map_probe)[source]

Calculate the DLSF score between two Map instances. The DLSF is similar to the LSF; whereas the LSF compares absolute density values, the DLSF compares the difference between pairs of values.

Arguments:
map_target, map_probe
the two Map instances to compare.
num_of_points
number of significant points.
Return:
DLSF score
laplace_CCC(map_target, map_probe, prefil=(False, False))[source]

Calculate Laplacian cross-correlation between two Map instances. Based on (Chacon and Wriggers, 2002).

Arguments:
map_target, map_probe
Map instances to compare.
prefil
2-tuple of boolean values, one for each map respectively. True if Map instance is already Laplacian-filtered. False otherwise.
Return:
Laplacian cross-correlation score
mapComparison(map_target, map_probe)[source]

Compare the properties (sampling rate, box size and origin) of two maps Arguments:

map_target, map_probe
Map instances to compare.
Return:
True if the map properties are the same between two maps, False otherwise.
normal_vector_score(map_target, map_probe, primary_boundary, secondary_boundary=0.0, Filter=None)[source]

Calculate the Normal Vector Score between two Map surfaces. Based on 3SOM algorithm (Ceulemans and Russell, 2004).

Arguments:
map_target, map_probe
EMMap instances to compare. map_target is the target map.
primary_boundary, secondary_boundary
If a filter is selected, just input a contour level as primary threshold. Otherwise, need to run get_primary_boundary and get_second_boundary based on map target.
Filter

Filter to use:

i Sobel Filter (Filter==’Sobel’)

ii Laplace Filter (Filter==’Laplace’)

iii Minimum Filter (Filter==’Minimum’)

iv Mean Filter (Filter==’Mean’)

Return:
Normal vector score.
scale_median(arr1, arr2)[source]

Scale one list/array of scores with respect to another based on distribution around median. Arguments:

arr1, arr2
scale an array of scores (arr1) based on another (arr2).
Return:
scaled arr1.