conkit.core.distogram module¶
Distogram container used throughout ConKit
-
class
Distogram(id)[source]¶ Bases:
conkit.core.contactmap.ContactMapA distogram object to store all associated information. This class inherits methods and attributes from
ContactMapExamples
>>> 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
Distograminstance into a :obj:numpy.array instance with shape - (seq_len, seq_len) where each element represents the predicted distance between residues
Parameters: Returns: numpy.arrayinstance that represents the distogram. Note: change of residue indexing, now starts in 0Return type: Raises: ValueError– No seq_len was provided andsequenceis not defined- Transform the
-
as_contactmap(distance_cutoff=8)[source]¶ Create a
ContactMapinstance with the contacts present in thisDistograminstance.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
Distograminstances.Parameters: - prediction (
Distogram) – A ConKitDistogramused as the prediction for the RMSD - model (
Distogram) – A ConKitDistogramused 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 aDistograminstance.- 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
DistanceinstanceParameters: 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 andsequenceis not defined
-
get_unique_distances(inplace=False)[source]¶ Filter the
Distanceinstances 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: ContactMapinstance, regardless of inplaceReturn type: ContactMap
-
static
merge_arrays(distogram_1, distogram_2)[source]¶ Take two
Distograminstances and merge them together into the samenumpy.arrayinstance. Each half square in this array will correspond with the predicted distances at each hierarchyParameters: Returns: numpy.arrayinstance that represents the combined distograms.Return type: Raises: ValueError– No sequence has been registered for one of theDistograminstancesValueError– The sequence length associated to theDistograminstances is incompatible
-
ndistances The number of
DistanceinstancesReturns: The number of distance pairs in the DistogramReturn type: int
-
original_file_format The original file format used to create the
Distograminstance
-
reshape_bins(new_bins)[source]¶ Reshape the predicted distance bins for all
Distanceinstances. This will updatedistance_scoresanddistance_binsto 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
-