-
Notifications
You must be signed in to change notification settings - Fork 0
/
InPrNa1.0.py
2241 lines (1958 loc) · 91.6 KB
/
InPrNa1.0.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# pymol lib
try:
from pymol import cmd
from pymol import *
#from cgo import *
except ImportError:
print 'Warning: pymol library cmd not found.'
sys.exit(1)
# external lib
try:
import Pmw
except ImportError:
print 'Warning: failed to import Pmw. Exit ...'
sys.exit(1)
try:
import ttk
import tkFileDialog
import tkColorChooser
except ImportError:
print 'Warning: failed to import ttk or tk. Exit ...'
try:
import numpy
except ImportError:
print 'Warning: failed to import numpy. Exit ...'
try:
import math
except ImportError:
print 'Warning: failed to import math. Exit ...'
try:
import Tkinter
from Tkinter import *
except:
import tkinter
import _tkinter
#from Tkinter import ScrolledText
try:
import ScrolledText as tkst
except:
import tkinter.scrolledtext as tkst
print 'Warning: failed to import ScrolledText. Exit ...'
def __init__(self):
self.menuBar.addmenuitem('Plugin', 'command',
'Interface Show', label='InPrNa1.0',
command=lambda s=self: start(s))
class start:
def __init__(self, app):
self.counter = 0.0
##interface information
self.pdbfile = ''
self.Resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface3_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface35_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface4_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface45_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface5_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface55_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface6_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface65_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface7_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface75_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface8_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface85_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface9_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface95_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface10_resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
#interface pdb infotmation
self.interface3_lead = []
self.interface35_lead = []
self.interface4_lead = []
self.interface45_lead = []
self.interface5_lead = []
self.interface55_lead = []
self.interface6_lead = []
self.interface65_lead = []
self.interface7_lead = []
self.interface75_lead = []
self.interface8_lead = []
self.interface85_lead = []
self.interface9_lead = []
self.interface95_lead = []
self.interface10_lead = []
##############
self.DNA_atom = []
self.protein_atom = []
##############################################
self.bump_Classify_6 = {'valley':[],
'flat':[],
'peak':[]}
##############################################
self.INTERFACE_DIS_3 = []
self.INTERFACE_DIS_35 = []
self.INTERFACE_DIS_4 = []
self.INTERFACE_DIS_45 = []
self.INTERFACE_DIS_5 = []
self.INTERFACE_DIS_55 = []
self.INTERFACE_DIS_6 = []
self.INTERFACE_DIS_65 = []
self.INTERFACE_DIS_7 = []
self.INTERFACE_DIS_75 = []
self.INTERFACE_DIS_8 = []
self.INTERFACE_DIS_85 = []
self.INTERFACE_DIS_9 = []
self.INTERFACE_DIS_95 = []
self.INTERFACE_DIS_10 = []
self.app1 = app
self.parent = app.root
self.dialog = Pmw.Dialog(self.parent,
buttons=('Browse', 'load PDB', 'Cancel'),
command=self.Ask_Dialog_Cmd)
# pdb_load_Ent = Entry(self.dialog.interior(), textvariable=self.pdb_file_path, width=35)
self.pdb_load_Ent = Text(self.dialog.interior(),height=1, width=30)
# pdb_load_Ent.delete()
self.pdb_load_Ent.grid(sticky='E')
def Ask_Dialog_Cmd(self, cmd ):
if cmd == 'Browse':
self.GetPDBFilePath()
# self.pdb_file_path.set(self.pdbfile)
self.pdb_load_Ent.delete(1.0,Tkinter.END)
self.pdb_load_Ent.insert(END,self.pdbfile)
elif cmd == 'load PDB':
# print 'hello'
self.LoadPDB(self.pdbfile)
self.dialog.withdraw()
self.plugin = Plugin(self.app1, self.pdbfile)
self.plugin.Resn_number = self.Resn_number
self.plugin.interface6_resn_number = self.interface6_resn_number
self.plugin.interface3_resn_number = self.interface3_resn_number
self.plugin.interface35_resn_number = self.interface35_resn_number
self.plugin.interface4_resn_number = self.interface4_resn_number
self.plugin.interface45_resn_number = self.interface45_resn_number
self.plugin.interface5_resn_number = self.interface5_resn_number
self.plugin.interface55_resn_number = self.interface55_resn_number
self.plugin.interface6_resn_number = self.interface6_resn_number
self.plugin.interface65_resn_number = self.interface65_resn_number
self.plugin.interface7_resn_number = self.interface7_resn_number
self.plugin.interface75_resn_number = self.interface75_resn_number
self.plugin.interface8_resn_number = self.interface8_resn_number
self.plugin.interface85_resn_number = self.interface85_resn_number
self.plugin.interface9_resn_number = self.interface9_resn_number
self.plugin.interface95_resn_number = self.interface95_resn_number
self.plugin.interface10_resn_number = self.interface10_resn_number
self.plugin.bump_Classify_6 = self.bump_Classify_6
self.plugin.bump_Classify_3 = self.bump_Classify_3
self.plugin.bump_Classify_35 = self.bump_Classify_35
self.plugin.bump_Classify_4 = self.bump_Classify_4
self.plugin.bump_Classify_45 = self.bump_Classify_45
self.plugin.bump_Classify_all = self.bump_Classify_all
self.plugin.bump_Classify_set["all_protein"] = self.bump_Classify_all
self.plugin.bump_Classify_set["3angstrom"] = self.bump_Classify_3
self.plugin.bump_Classify_set["3.5angstrom"] = self.bump_Classify_35
self.plugin.bump_Classify_set["4angstrom"] = self.bump_Classify_4
self.plugin.bump_Classify_set["4.5angstrom"] = self.bump_Classify_45
self.plugin.bump_Classify_set["6angstrom"] = self.bump_Classify_6
self.plugin.interface3_lead = self.interface3_lead
self.plugin.interface35_lead = self.interface35_lead
self.plugin.interface4_lead = self.interface4_lead
self.plugin.interface45_lead = self.interface45_lead
self.plugin.interface5_lead = self.interface5_lead
self.plugin.interface55_lead = self.interface55_lead
self.plugin.interface6_lead = self.interface6_lead
self.plugin.interface65_lead = self.interface65_lead
self.plugin.interface7_lead = self.interface7_lead
self.plugin.interface75_lead = self.interface75_lead
self.plugin.interface8_lead = self.interface8_lead
self.plugin.interface85_lead = self.interface85_lead
self.plugin.interface9_lead = self.interface9_lead
self.plugin.interface95_lead = self.interface95_lead
self.plugin.interface10_lead = self.interface10_lead
# print "flat"
self.plugin.bump_Classify_flat=self.bump_Classify_all
self.plugin.bump_Classify_peak=self.bump_Classify_all
self.plugin.bump_Classify_valley=self.bump_Classify_all
self.plugin.INTERFACE_DIS_3 = self.INTERFACE_DIS_3
self.plugin.INTERFACE_DIS_35 = self.INTERFACE_DIS_35
self.plugin.INTERFACE_DIS_4 = self.INTERFACE_DIS_4
self.plugin.INTERFACE_DIS_45 = self.INTERFACE_DIS_45
self.plugin.INTERFACE_DIS_5 = self.INTERFACE_DIS_5
self.plugin.INTERFACE_DIS_55 = self.INTERFACE_DIS_55
self.plugin.INTERFACE_DIS_6 = self.INTERFACE_DIS_6
self.plugin.INTERFACE_DIS_65 = self.INTERFACE_DIS_65
self.plugin.INTERFACE_DIS_7 = self.INTERFACE_DIS_7
self.plugin.INTERFACE_DIS_75 = self.INTERFACE_DIS_75
self.plugin.INTERFACE_DIS_8 = self.INTERFACE_DIS_8
self.plugin.INTERFACE_DIS_85 = self.INTERFACE_DIS_85
self.plugin.INTERFACE_DIS_9 = self.INTERFACE_DIS_9
self.plugin.INTERFACE_DIS_95 = self.INTERFACE_DIS_95
self.plugin.INTERFACE_DIS_10 = self.INTERFACE_DIS_10
self.plugin.INTERFACE_CONTENT = self.INTERFACE_DIS_6
elif cmd == 'Cancel':
print('Exiting Plugin ...')
if __name__ == '__main__':
self.parent.destroy()
else:
self.dialog.withdraw()
print('Done.')
else:
self.dialog.withdraw()
def GetPDBFilePath(self):
self.pdbfile = tkFileDialog.askopenfilename()
def LoadPDB(self, pdbfile):
if pdbfile is not None:
cmd.load(pdbfile)
cmd.color('gray')
cmd.show('sphere')
############
## Main
###########
atom_content_dir = self.Open_PDB_content(pdbfile)
self.All_protein_Atom = self.calcu_durg_pdb_interface(pdbfile)
self.bump_Classify_all = self.BumpClassify(self.protein_atom,atom_content_dir)
self.bump_Classify_6 = self.BumpClassify(self.INTERFACE_DIS_6, atom_content_dir)
self.bump_Classify_3 = self.BumpClassify(self.INTERFACE_DIS_3, atom_content_dir)
self.bump_Classify_35 = self.BumpClassify(self.INTERFACE_DIS_35, atom_content_dir)
self.bump_Classify_4 = self.BumpClassify(self.INTERFACE_DIS_4, atom_content_dir)
self.bump_Classify_45 = self.BumpClassify(self.INTERFACE_DIS_45, atom_content_dir)
self.progress_window.destroy()
#SELECT INTERFACE
cmd.select('Nucleic', 'resn DA+DC+DG+DT+DU+A+T+G+C+I+U+5IU')
# cmd.select("interface", resn + ' and ' + resi + ' and ' + chain,)
self.selector(self.INTERFACE_DIS_6,"interface")
cmd.create("INTERFACE1", "interface")
# cmd.hide()
self.selector(self.All_protein_Atom,"protein")
# cmd.hide("everything", "protein")
# cmd.show("surface","protein")
# cmd.create("PROTEIN", "protein")
# cmd.hide("everything", "protein")
cmd.select('Nucleic', 'resn DA+DC+DG+DT+DU+A+T+G+C+I+U+5IU')
#cmd.extract("protein","proteins")
#cmd.extract("Nucleic","Nucleics")
else:
print ('NO Path Input')
def calcu_dis(self, coord_1, coord_2):
coord_1_X = float(coord_1[0])
coord_1_Y = float(coord_1[1])
coord_1_Z = float(coord_1[2])
coord_2_X = float(coord_2[0])
coord_2_Y = float(coord_2[1])
coord_2_Z = float(coord_2[2])
Euclid_Dis = math.sqrt(
((coord_1_X - coord_2_X) ** 2) + ((coord_1_Y - coord_2_Y) ** 2) + ((coord_1_Z - coord_2_Z) ** 2))
return Euclid_Dis
#no DNA
def Open_PDB_content(self, pdb_file_name):
file_handle = open(pdb_file_name, 'r')
counter = 0
atom_content_dir = {}
for file_content in file_handle:
if file_content[0:4] == 'ATOM':
if file_content[17:20] != ' DA' and \
file_content[17:20] != ' DT' and \
file_content[17:20] != ' DG' and \
file_content[17:20] != ' DC' and \
file_content[17:20] != ' A' and \
file_content[17:20] != ' C' and \
file_content[17:20] != ' G' and \
file_content[17:20] != ' T' and \
file_content[17:20] != ' U' and \
file_content[17:20] != ' I':
atom_content_dir[counter] = file_content
counter = counter + 1
# print counter
return atom_content_dir
def Calcu_PDB_CA_SI(self, Valid_ATOM_Num):
Vint = Valid_ATOM_Num * 20.1
Vsphere = 4 * math.pi * 12 ** 3 / 3
Vext = Vsphere - Vint
CX = (Vext - Vint) / Vsphere
return CX
def calcu_durg_pdb_interface(self, pdb_file_name):
ATOM_content = []
DX_content = []
pdb_content_handle = open(pdb_file_name, 'r')
for DX_Cell in pdb_content_handle:
if DX_Cell[0:4] == 'ATOM':
self.counter += 1
if DX_Cell[17:20] == ' DA' or \
DX_Cell[17:20] == ' DT' or \
DX_Cell[17:20] == ' DG' or \
DX_Cell[17:20] == ' DC' or \
DX_Cell[17:20] == ' A' or \
DX_Cell[17:20] == ' C' or \
DX_Cell[17:20] == ' G' or \
DX_Cell[17:20] == ' T' or \
DX_Cell[17:20] == ' U' or \
DX_Cell[17:20] == ' I' :
# and DX_Cell[13:15] == 'CA':
# print DX_Cell
DX_content.append(DX_Cell)
else:
if DX_Cell[13:15] == 'CA':
self.Resn_number[DX_Cell[17:20]] += 1
ATOM_content.append(DX_Cell)
pdb_content_handle.close()
self.protein_atom = ATOM_content
self.DNA_atom = DX_content
# progress tk window
self.progress_window = Tk()
self.progress_window.title('Calculating')
self.progress_window.geometry('630x150')
## 设置进度条
ttk.Label(self.progress_window, text='Progress:', ).place(x=45, y=60)
self.canvas = Canvas(self.progress_window, width=465, height=22, bg="white")
self.fill_line = self.canvas.create_rectangle(1.5, 1.5, 0, 23, width=0, fill="green")
self.canvas.place(x=110, y=60)
x = self.counter # 未知变量,可更改
self.progress_counters = float(465.0/self.counter) # 是矩形填充满的次数
# print n
##################################
for Atom in ATOM_content:
min_dis = 9999
Atom_cood = [Atom[30:38], Atom[38:46], Atom[46:54]]
interface_flag = 0
####progress
self.progress_counters = float(self.progress_counters + 465.0 / x)
info_6 = ""
for Dx in DX_content:
DX_cood = [Dx[30:38], Dx[38:46], Dx[46:54]]
dis = self.calcu_dis(Atom_cood, DX_cood)
info = Atom[:26] + " --- " + Dx[:26]
if min_dis > dis:
min_dis = dis
info_6 = Atom[:26] + " --- " + Dx[:26]
if min_dis < 6:
self.INTERFACE_DIS_6.append(Atom)
self.interface6_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface6_resn_number[Atom[17:20]] += 1
if min_dis < 3:
self.INTERFACE_DIS_3.append(Atom)
self.interface3_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface3_resn_number[Atom[17:20]] += 1
if min_dis < 3.5:
self.INTERFACE_DIS_35.append(Atom)
self.interface35_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface35_resn_number[Atom[17:20]] += 1
if min_dis < 4:
self.INTERFACE_DIS_4.append(Atom)
self.interface4_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface4_resn_number[Atom[17:20]] += 1
if min_dis < 4.5:
self.INTERFACE_DIS_45.append(Atom)
self.interface45_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface45_resn_number[Atom[17:20]] += 1
if min_dis < 5.5:
self.INTERFACE_DIS_55.append(Atom)
self.interface55_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface55_resn_number[Atom[17:20]] += 1
if min_dis < 6.5:
self.INTERFACE_DIS_65.append(Atom)
self.interface65_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface65_resn_number[Atom[17:20]] += 1
if min_dis < 7:
self.INTERFACE_DIS_7.append(Atom)
self.interface7_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface7_resn_number[Atom[17:20]] += 1
if min_dis < 7.5:
self.INTERFACE_DIS_75.append(Atom)
self.interface75_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface75_resn_number[Atom[17:20]] += 1
if min_dis < 8:
self.INTERFACE_DIS_8.append(Atom)
self.interface8_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface8_resn_number[Atom[17:20]] += 1
if min_dis < 8.5:
self.INTERFACE_DIS_85.append(Atom)
self.interface85_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface85_resn_number[Atom[17:20]] += 1
if min_dis < 9:
self.INTERFACE_DIS_9.append(Atom)
self.interface9_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface9_resn_number[Atom[17:20]] += 1
if min_dis < 9.5:
self.INTERFACE_DIS_95.append(Atom)
self.interface95_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface95_resn_number[Atom[17:20]] += 1
if min_dis < 10:
self.INTERFACE_DIS_10.append(Atom)
self.interface10_lead.append(info_6)
if Atom[13:15] == 'CA':
self.interface10_resn_number[Atom[17:20]] += 1
self.canvas.coords(self.fill_line, (0, 0, self.progress_counters, 60))
self.progress_window.update()
return ATOM_content
# print Interface_content
def calcu_dis(self, coord_1, coord_2):
coord_1_X = float(coord_1[0])
coord_1_Y = float(coord_1[1])
coord_1_Z = float(coord_1[2])
coord_2_X = float(coord_2[0])
coord_2_Y = float(coord_2[1])
coord_2_Z = float(coord_2[2])
Euclid_Dis = numpy.sqrt(
((coord_1_X - coord_2_X) ** 2) + ((coord_1_Y - coord_2_Y) ** 2) + ((coord_1_Z - coord_2_Z) ** 2))
return Euclid_Dis
def BumpClassify(self, Atom_content, atom_content_dir):
bump_Classify = {'valley':[],
'flat':[],
'peak':[]}
for Cell in Atom_content:
# print Cell
ca_cood = (Cell[30:38], Cell[38:46], Cell[46:54])
atom_counter = 0
for key in atom_content_dir:
coord_2 = (atom_content_dir[key][30:38], atom_content_dir[key][38:46], atom_content_dir[key][46:54])
dis = self.calcu_dis(ca_cood, coord_2)
if dis < 12:
atom_counter = atom_counter + 1
CX = self.Calcu_PDB_CA_SI(atom_counter)
# print CX
if CX < -0.2:
shape = "valley"
bump_Classify['valley'].append(Cell)
# self.valleyCell.append(Cell)
elif CX < 0.2:
shape = 'flat'
bump_Classify['flat'].append(Cell)
# self.flatCell.append(Cell)
else:
shape = "peak"
bump_Classify['peak'].append(Cell)
# self.peakCell.append(Cell)
return bump_Classify
def selector(self,content,sele_name):
for i in content:
# con_list.append(i[17:20])
cmd.select(sele_name, ' resn ' +i[17:20]+ ' and resi' + i[22:26] + ' and chain ' +i[21],merge=1)
#################
# GUI related
#################
class Plugin:
def __init__(self, app, pdbfile):
self.parent = app.root
self.pdb_file_path = pdbfile
self.DIS = 6
self.interface_mod = "spheres"
self.protein_mod = "spheres"
self.INTERFACE_CONTENT = []
###############################
#dafault all_protein
self.bump_Classify_valley = {'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_flat = {'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_peak = {'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_all={'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_3={'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_35={'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_4={'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_45={'valley': [],
'flat': [],
'peak': []}
self.bump_Classify_6={'valley': [],
'flat': [],
'peak': []}
# defalut set all_protein
self.bump_Classify_set = {}
self.valleyCell = []
self.flatCell = []
self.peakCell = []
self.valley_range_get = ''
################################
self.INTERFACE_DIS_3 = []
self.INTERFACE_DIS_35 = []
self.INTERFACE_DIS_4 = []
self.INTERFACE_DIS_45 = []
self.INTERFACE_DIS_5 = []
self.INTERFACE_DIS_55 = []
self.INTERFACE_DIS_6 = []
self.INTERFACE_DIS_7 = []
self.INTERFACE_DIS_75 = []
self.INTERFACE_DIS_8 = []
self.INTERFACE_DIS_85 = []
self.INTERFACE_DIS_9 = []
self.INTERFACE_DIS_95 = []
self.INTERFACE_DIS_10 = []
################################
# COLOR VAR
self.surf_col = '#7CFC00'
self.protein_col = '#666666'
self.nucleic_col = '#666666'
self.bump_col = '#FF3030'
self.valley_col = '#FF0000'
self.peak_col = '#0000FF'
self.flat_col = '#00FF00'
self.property_col = '#7CFC00'
self.surf_col_tuple = (124, 252, 0)
self.valley_col_tuple = (255, 0, 0)
self.flat_col_tuple = (0, 255, 0)
self.peak_col_tuple = (0, 0, 255)
self.property_col_tuple = (125, 250, 0)
self.protein_col_tuple = (88, 87, 86)
self.nucleic_col_tuple = (88, 87, 86)
cmd.set_color('valley_col', self.valley_col_tuple)
cmd.set_color('flat_col', self.flat_col_tuple)
cmd.set_color('peak_col', self.peak_col_tuple)
#info
self.interface3_lead = []
self.interface35_lead = []
self.interface4_lead = []
self.interface45_lead = []
self.interface5_lead = []
self.interface55_lead = []
self.interface6_lead = []
self.interface65_lead = []
self.interface7_lead = []
self.interface75_lead = []
self.interface8_lead = []
self.interface85_lead = []
self.interface9_lead = []
self.interface95_lead = []
self.interface10_lead = []
################################
self.Resn_number = {'ALA': 0,
'ARG': 0,
'ASN': 0,
'ASP': 0,
'CYS': 0,
'GLN': 0,
'GLU': 0,
'GLY': 0,
'HIS': 0,
'ILE': 0,
'LEU': 0,
'LYS': 0,
'MET': 0,
'PHE': 0,
'PRO': 0,
'SER': 0,
'THR': 0,
'TRP': 0,
'TYR': 0,
'VAL': 0,
}
self.interface3_resn_number = {'ALA': 0,
'ARG': 0,