conkit.plot.tools module¶
Internal utility functions
-
class
ColorDefinitions
[source]¶ Bases:
object
A class storing all color definitions for the various plots for fast and easy handling
-
AA_ENCODING
= {'A': '#882D17', 'C': '#F3C300', 'D': '#875692', 'E': '#F38400', 'F': '#A1CAF1', 'G': '#BE0032', 'H': '#C2B280', 'I': '#848482', 'K': '#008856', 'L': '#E68FAC', 'M': '#0067A5', 'N': '#F99379', 'P': '#604E97', 'Q': '#F6A600', 'R': '#B3446C', 'S': '#DCD300', 'T': '#8DB600', 'V': '#654522', 'W': '#E25822', 'X': '#000000', 'Y': '#2B3D26'}¶
-
ALIGNED
= '#3d8beb'¶
-
CORRECT
= '#40eef7'¶
-
ERROR
= '#f54242'¶
-
FACTOR1
= '#B5DD2B'¶
-
GENERAL
= '#000000'¶
-
L20CUTOFF
= '#B5DD2B'¶
-
L5CUTOFF
= '#3F4587'¶
-
MATCH
= '#0F0B2C'¶
-
MISALIGNED
= '#f7ba40'¶
-
MISMATCH
= '#DC4869'¶
-
PRECISION50
= '#3F4587'¶
-
SCORE
= '#3299a8'¶
-
STRUCTURAL
= '#D8D6D6'¶
-
-
calculate_zscore
(observed_score, population_scores)[source]¶ Calculate the Z-Score for a given population of values. Z-Score = (score - mean) / stdev
Parameters: Returns: The calculated Z-Score
Return type:
-
convolution_smooth_values
(x, window=5)[source]¶ Use convolutions to smooth a list of numeric values
Parameters: Returns: A list with the smoothed numeric values
Return type:
-
find_minima
(data, order=1)[source]¶ Find the minima in a 1-D list
Parameters: Returns: A list of indices for minima
Return type: Warning
For multi-dimensional problems, see
argrelmin()
.Raises: ValueError
– Order needs to be >= 1!ValueError
– More than two elements required!
-
get_adjusted_aspect
(ax, aspect_ratio)[source]¶ Adjust the aspect ratio
Parameters: Returns: The required aspect ratio to achieve the desired one
Return type: Warning
This function only works for non-logarithmic axes.
-
get_cmap_validation_metrics
(model_cmap_dict, predicted_cmap_dict, sequence, absent_residues)[source]¶ For a given observed contact map and predicted contact map calculate a series of validation metrics at each residue position (Accuracy, FN, FNR, FP, FPR, Sensitivity, Specificity)
Parameters: - model_cmap_dict (dict) – Dictionary representation of the contact map observed in the model
- predicted_cmap_dict (dict) – Dictionary representation of the predicted contact map
- sequence (
Sequence
) – The sequence of the model to be validated - absent_residues (list, tuple, set) – The residues that are missing from the model
Returns: Two lists with the raw/smoothed values of each validation metric at each residue position
Return type:
-
get_points_on_circle
(radius, h=0, k=0)[source]¶ Calculate points on a circle with even spacing
Parameters: Returns: The list of coordinates for each point
Return type:
-
get_radius_around_circle
(p1, p2)[source]¶ Obtain the radius around a given circle
Parameters: Returns: The radius for points so p1 and p2 do not intersect
Return type:
-
get_residue_ranges
(numbers)[source]¶ Given a list of integers, creates a list of ranges with the consecutive numbers found in the list.
Parameters: numbers (list) – A list of integers Returns: A list with the ranges of consecutive numbers found in the list Return type: list
-
get_rmsd
(distogram_1, distogram_2, calculate_wrmsd=True)[source]¶ Calculate the RMSD between two different distograms
Parameters: Returns: Two lists with the raw/smoothed RMSD values at each residue position
Return type:
-
get_zscores
(model_distogram, predicted_cmap_dict, absent_residues, *metrics)[source]¶ Calculate the Z-Scores for a series of metrics at each residue position using the population of residues within 10A
Parameters: - model_distogram (
Distogram
) – Distogram of the model that will be validated - predicted_cmap_dict (dict) – Dictionary representation of the predicted contact map
- absent_residues (list, tuple, set) – The residues that are missing from the model
- *metrics (list) – The mertics for which the Z-Scores will be calculated
Returns: A list of lists where each sublist contains the Z-Scores for the input metrics across all the residues. The sublists containing the Z-Scores are ordered in the same original order as in the input *metrics
Return type: - model_distogram (
-
is_executable
(executable)[source]¶ Check if a given program can be executed
Parameters: executable (str) – The path or name for an executable
Returns: The absolute path to the executable
Return type: Raises: ValueError
– The executable cannot be accessedCredits
-------
- https://stackoverflow.com/a/377028/3046533
-
parse_map_align_stdout
(stdout)[source]¶ Parse the stdout of map_align and extract the alignment of residues.
Parameters: stdout (str) – Standard output created with map_align Returns: A dictionary where aligned residue numbers in map_b are the keys and residue numbers in map_a values. Only misaligned regions are included. Return type: dict