-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions_matrices_from_clusters_criteria.py
167 lines (130 loc) · 9.09 KB
/
functions_matrices_from_clusters_criteria.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
from enum import Enum, unique , auto
hb_cutoff = 4.0
rmsd_cutoff = 1.0
sequonrmsd_cutoff = 0.9
class hb_bond_criteria(Enum):
significant_clusters_cutoff = auto()
significant_clusters = auto()
significant_clusters_largest_cluster = auto()
largest_cluster = auto()
significant_clusters_cutoff_rmsd = auto()
significant_clusters_cutoff_rmsd_only = auto()
significant_clusters_cutoff_sequonrmsd = auto()
significant_clusters_cutoff_sequonrmsd_only = auto()
significant_clusters_sinks = auto()
significant_clusters_sinks_TopKCal = auto()
significant_clusters_sinks_cutoff = auto()
significant_clusters_sinks_TopKCal_cutoff = auto()
significant_clusters_sinks_cutoff_rmsd = auto()
significant_clusters_sinks_cutoff_rmsd_only = auto()
significant_clusters_sinks_cutoff_dmc_only = auto()
significant_clusters_sinks_TopKCal_cutoff_rmsd = auto()
significant_clusters_sinks_TopKCal_cutoff_rmsd_only = auto()
significant_clusters_sinks_GTX_cutoff_rmsd = auto()
significant_clusters_sinks_GTX_TopKCal_cutoff_rmsd = auto()
significant_clusters_sinks_cutoff_sequonrmsd = auto()
significant_clusters_sinks_cutoff_sequonrmsd_only = auto()
significant_clusters_sinks_TopKCal_cutoff_sequonrmsd = auto()
significant_clusters_sinks_TopKCal_cutoff_sequonrmsd_only = auto()
significant_clusters_sinks_GTX_cutoff_sequonrmsd = auto()
significant_clusters_sinks_GTX_TopKCal_cutoff_sequonrmsd = auto()
significant_clusters_sinks_TTY_cutoff = auto()
significant_clusters_sinks_TTY_TopKCal_cutoff = auto()
significant_clusters_sinks_cutoff_rmsd_ie = auto()
def get_type_value(criteria):
type_value = 'centroids'
if criteria==hb_bond_criteria.significant_clusters_sinks or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_rmsd or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_rmsd_only or criteria == hb_bond_criteria.significant_clusters_sinks_GTX_cutoff_rmsd or criteria == hb_bond_criteria.significant_clusters_sinks_TTY_cutoff or criteria == hb_bond_criteria.significant_clusters_sinks_cutoff_sequonrmsd or criteria == hb_bond_criteria.significant_clusters_sinks_cutoff_sequonrmsd_only or criteria == hb_bond_criteria.significant_clusters_sinks_GTX_cutoff_sequonrmsd or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_rmsd_ie:
type_value='sinks'
if criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_rmsd or criteria == hb_bond_criteria.significant_clusters_sinks_TTY_TopKCal_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_sequonrmsd or criteria == hb_bond_criteria.significant_clusters_sinks_GTX_TopKCal_cutoff_sequonrmsd:
type_value='sinks_TopKCal'
return type_value
def check_criteria_decoy(values,criteria=hb_bond_criteria.significant_clusters_sinks_cutoff):
[value1,value2] = values
print('values',value1)
if criteria==hb_bond_criteria.significant_clusters_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff:
return value1 < hb_cutoff
if criteria==hb_bond_criteria.significant_clusters_sinks_TTY_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_TTY_TopKCal_cutoff:
return (value1 > hb_cutoff and value1 < 5.5 and value2 < 1.6)
if criteria==hb_bond_criteria.significant_clusters_cutoff_rmsd_only or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_rmsd_only or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_rmsd_only:
return value2 < rmsd_cutoff
if criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_sequonrmsd_only or criteria==hb_bond_criteria.significant_clusters_cutoff_sequonrmsd_only:
return value2 < sequonrmsd_cutoff
if criteria==hb_bond_criteria.significant_clusters_cutoff_rmsd or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_rmsd or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_rmsd:
return ( value1 < hb_cutoff and value2 < rmsd_cutoff )
if criteria==hb_bond_criteria.significant_clusters_cutoff_sequonrmsd or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_sequonrmsd or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_sequonrmsd:
return ( value1 < hb_cutoff and value2 < sequonrmsd_cutoff )
if criteria==hb_bond_criteria.significant_clusters_sinks_GTX_cutoff_rmsd or criteria==hb_bond_criteria.significant_clusters_sinks_GTX_TopKCal_cutoff_rmsd:
return ( value1 <= hb_cutoff and value2 >= rmsd_cutoff )
def check_hb_criteria(centroids,sizedict,sizedict_normalized,criteria=hb_bond_criteria.significant_clusters,axis=1):
fieldname = 'distance_catalysis_HWUO1B-THR7N'
cluster_ids=[]
axis_rmsd = 0
axis_sequonrmsd = 3 # 0-x,1-y,2-z,3-z3
if criteria==hb_bond_criteria.significant_clusters_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
if centroids[k,axis]<hb_cutoff:
cluster_ids.append(k)
if criteria==hb_bond_criteria.significant_clusters_sinks_TTY_cutoff or criteria==hb_bond_criteria.significant_clusters_sinks_TTY_TopKCal_cutoff:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
if (centroids[k,axis]>hb_cutoff and centroids[k,axis]<5.5 and centroids[k,axis_rmsd] < 1.6):
cluster_ids.append(k)
if criteria==hb_bond_criteria.significant_clusters_cutoff_rmsd_only or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_rmsd_only or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_rmsd_only:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
if centroids[k,axis_rmsd]<rmsd_cutoff:
cluster_ids.append(k)
if criteria==hb_bond_criteria.significant_clusters_cutoff_sequonrmsd_only or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_sequonrmsd_only or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_sequonrmsd_only:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
if centroids[k,axis_sequonrmsd]<sequonrmsd_cutoff and centroids[k,axis_rmsd]<rmsd_cutoff:
cluster_ids.append(k)
if criteria==hb_bond_criteria.significant_clusters_cutoff_rmsd or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_rmsd or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_rmsd:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
#print('centroids ', centroids[k,:])
if centroids[k,axis]<=hb_cutoff and centroids[k,axis_rmsd]<rmsd_cutoff:
cluster_ids.append(k)
#print("CRITERIA CUTOFF ",cluster_ids)
if criteria==hb_bond_criteria.significant_clusters_cutoff_sequonrmsd or criteria==hb_bond_criteria.significant_clusters_sinks_cutoff_sequonrmsd or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal_cutoff_sequonrmsd:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
#print('centroids ', centroids[k,:])
if centroids[k,axis]<=hb_cutoff and centroids[k,axis_sequonrmsd]<sequonrmsd_cutoff:
cluster_ids.append(k)
#print("CRITERIA CUTOFF ",cluster_ids)
if criteria==criteria==hb_bond_criteria.significant_clusters_sinks_GTX_cutoff_rmsd or criteria==hb_bond_criteria.significant_clusters_sinks_GTX_TopKCal_cutoff_rmsd:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
#print('centroids ', centroids[k,:])
if centroids[k,axis]<=hb_cutoff and centroids[k,axis_rmsd] >= rmsd_cutoff:
cluster_ids.append(k)
#print("CRITERIA CUTOFF ",cluster_ids)
if criteria==criteria==hb_bond_criteria.significant_clusters_sinks_GTX_cutoff_sequonrmsd or criteria==hb_bond_criteria.significant_clusters_sinks_GTX_TopKCal_cutoff_sequonrmsd:
for k in sizedict:
if sizedict_normalized[k]<0.05: continue
if k == -1: continue
#print('centroids ', centroids[k,:])
if centroids[k,axis]<=hb_cutoff and centroids[k,axis_sequonrmsd] >= sequonrmsd_cutoff:
cluster_ids.append(k)
#print("CRITERIA CUTOFF ",cluster_ids)
if criteria==hb_bond_criteria.significant_clusters or criteria==hb_bond_criteria.significant_clusters_sinks or criteria==hb_bond_criteria.significant_clusters_sinks_TopKCal:
for k in sizedict:
#if sizedict_normalized[k]<0.05: continue
if k == -1: continue
cluster_ids.append(k)
if criteria==hb_bond_criteria.significant_clusters_largest_cluster:
maxclus = max(sizedict_normalized, key = lambda x: sizedict_normalized.get(x) )
cluster_ids.append(maxclus)
if criteria==hb_bond_criteria.largest_cluster:
maxclus = max(sizedict_normalized, key = lambda x: sizedict_normalized.get(x) )
cluster_ids.append(maxclus)
return cluster_ids