1 """
2 HMM fragments derived from HHpred HMM profiles.
3
4 @deprecated: This module may be removed in the future.
5 """
6 import re
7 import csb.bio.fragments
8 import csb.bio.hmm
9 import csb.bio.structure as structure
10 import csb.bio.fragments.isites as isites
11
12 from csb.bio.hmm import ProfileHMMSegment, ProfileHMMRegion
15 """
16 Describes a HMM segment which can be slid over a subject profile.
17 See the documentation of the base class for the signature of the
18 constructor.
19 """
20
22 """
23 Find instances of self by sliding it over other and computing
24 emission vector similarity and RSMD.
25
26 @param other: the subject HMM
27 @type other: L{ProfileHMM}
28
29 @return: a list of L{isites.ProfileMatch}-es
30 @rtype: list
31 """
32 return self._slide_over(self, other)
33
35
36 query_residues = this.chain()
37 window = this.layers.length
38 matches = []
39
40 i = that.layers.start_index
41 while True:
42 if that.layers.last_index - i + 1 < window:
43 break
44
45 score, tm, tm_out, rmsd_ca = None, None, None, None
46 start = i
47 end = i + window - 1
48
49 subject = ProfileHMMRegion(that, start, end)
50 subject_residues = structure.Chain(that.id[4].upper(), residues=that.residues[start : start + window])
51
52 score = this.emission_similarity(subject)
53
54 try:
55 rmsd_ca = query_residues.rmsd(subject_residues)
56 except structure.Broken3DStructureError:
57 rmsd_ca = None
58
59 if score is not None and (rmsd_ca is not None):
60 match = isites.ProfileMatch(that.id, start, score, rmsd_ca, None, tm, tm_out)
61 matches.append(match)
62
63 i += 1
64
65 return matches
66
68 """
69 Describes a HMM segment which can be slid over a subject profile.
70 Wraps an existing L{ProfileHMMSegment} to decorate it with a slide_over
71 method.
72
73 @param hmm_segment: the HMM segment to wrap as a fragment
74 @type hmm_segment: L{ProfileHMMSegment}
75 """
76
78
79 self._segment = hmm_segment
80
82
83 return self._slide_over(self._segment, other)
84
86 """
87 Library wrapper for H-Sites fragments.
88
89 @param fragments: a list of L{HMMFragment}s
90 @type list:
91 """
92
94
95 self._ondemand = False
96
97 self._fragments = []
98 self._byid = {}
99 self._byrep = {}
100 self.name = 'HSites'
101
102 if fragments is not None:
103 self.fragments = fragments
104
105 @property
107 return self._fragments
108 @fragments.setter
117
118 @property
121 @clusters.setter
124
126
127 - def __init__(self, fragment, qstart, qend, probability, rmsd, tm_score, qlength):
141
142 @property
145
146 @property
149
150 @property
153