conkit.core.distogram module¶
Distogram container used throughout ConKit
-
class
Distogram
(id)[source]¶ Bases:
conkit.core.contactmap.ContactMap
A distogram object to store all associated information. This class inherits methods and attributes from
ContactMap
Examples
>>> import numpy as np >>> from conkit.core import Distance >>> from conkit.core import Distogram >>> distogram = Distogram("example") >>> distogram.add(Distance(1, 25, (0.25, 0.45, 0.25, 0.05), ((0, 4), (4, 6), (6, 8), (8, np.inf)))) >>> distogram.add(Distance(7, 19, (0.15, 0.15, 0.60, 0.1), ((0, 4), (4, 6), (6, 8), (8, np.inf)))) >>> print(distogram) Distogram(id="example" ndistances=2)
-
as_array
(seq_len=None, get_weigths=False)[source]¶ - Transform the
Distogram
instance into a :obj:numpy.array instance with shape - (seq_len, seq_len) where each element represents the predicted distance between residues
Parameters: Returns: numpy.array
instance that represents the distogram. Note: change of residue indexing, now starts in 0Return type: Raises: ValueError
– No seq_len was provided andsequence
is not defined- Transform the
-
as_contactmap
(distance_cutoff=8)[source]¶ Create a
ContactMap
instance with the contacts present in thisDistogram
instance.Parameters: distance_cutoff (int, float) – The distance cutoff used to consider a residue pair within contact of each other Returns: A contactmap with the contacts present in this distogram instance. Return type: ContactMap
-
static
calculate_rmsd
(prediction, model, seq_len=None, calculate_wrmsd=False)[source]¶ Calculate the RMSD between two
Distogram
instances.Parameters: - prediction (
Distogram
) – A ConKitDistogram
used as the prediction for the RMSD - model (
Distogram
) – A ConKitDistogram
used as the model to calculate the RMSD - seq_len (int, optional) – Sequence length. If not provided, it will be pulled from
sequence
[default: None] - calculate_wrmsd (bool) – If set to True wRMSD is calculated using distance confidence scores [default: False]
Returns: A list of floats with the RMSD values along the sequence
Return type: Raises: ValueError
– other is not aDistogram
instance.- prediction (
-
find_residues_within
(resnum, distance_cutoff)[source]¶ Find all residues within a given distance of a given residue
Parameters: Returns: A set with the residue numbers of residues within the given distance
Return type:
-
get_absent_residues
(seq_len=None)[source]¶ Get residues not represented by any
Distance
instanceParameters: seq_len (int, optional) – Sequence length. If not provided, it will be pulled from sequence
[default: None]Returns: A list of absent residues Return type: list Raises: ValueError
– No seq_len was provided andsequence
is not defined
-
get_unique_distances
(inplace=False)[source]¶ Filter the
Distance
instances so that each residue pairs is present only onceParameters: inplace (bool, optional) – Replace stored distances with the unique distances in the current instance [default: False] Returns: ContactMap
instance, regardless of inplaceReturn type: ContactMap
-
static
merge_arrays
(distogram_1, distogram_2)[source]¶ Take two
Distogram
instances and merge them together into the samenumpy.array
instance. Each half square in this array will correspond with the predicted distances at each hierarchyParameters: Returns: numpy.array
instance that represents the combined distograms.Return type: Raises: ValueError
– No sequence has been registered for one of theDistogram
instancesValueError
– The sequence length associated to theDistogram
instances is incompatible
-
ndistances
The number of
Distance
instancesReturns: The number of distance pairs in the Distogram
Return type: int
-
original_file_format
The original file format used to create the
Distogram
instance
-
reshape_bins
(new_bins)[source]¶ Reshape the predicted distance bins for all
Distance
instances. This will updatedistance_scores
anddistance_bins
to fit the new bins.Parameters: new_bins (tuple) – A tuple of tuples, where each element corresponds with the upper and lower edges of the intervals for the new distance bins Raises: ValueError
– The new distance bins are not valid
-