-
Notifications
You must be signed in to change notification settings - Fork 0
/
pymolpy.snippets
2276 lines (2150 loc) · 93.3 KB
/
pymolpy.snippets
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
# PyMOL Python snippets
snippet ao
cmd.do("set_color oxygen, [1.0,0.4,0.4];")
cmd.do("set_color nitrogen, [0.5,0.5,1.0];")
cmd.do("remove solvent;")
cmd.do("as spheres;")
cmd.do("# the \"as\" command is a shortcut for show_as")
cmd.do("util.cbaw;")
cmd.do("# \"cba\" represents \"color by atom\". ")
cmd.do("# The last letter represents the colore of the carbon atom.")
cmd.do("bg white;")
cmd.do("# bg is an alias for bg_color or background color.")
cmd.do("set light_count,10;")
cmd.do("# light_count is the number of light sources. ")
cmd.do("# The max is 10. The defualt is 10.")
cmd.do("set spec_count,1;")
cmd.do("# Not documented on Wiki.")
cmd.do("set shininess, 10;")
cmd.do("# sets the shininess of the object.")
cmd.do("set specular,0.25;")
cmd.do("# Controls the amount of directly reflected light and not the shininess of the reflection.")
cmd.do("set ambient,0;")
cmd.do("# Controls the amount of ambient light. Default is 0. Ranges from -1 to 1.")
cmd.do("set direct,0; ")
cmd.do("# Not documented on Wiki.")
cmd.do("set reflect,1.5;")
cmd.do("# Controls the amount of light reflection and the effect that directional light has on shadows ")
cmd.do("# and the general lighting of the scene. Default value is 0.5.")
cmd.do("set ray_shadow_decay_factor, 0.1;")
cmd.do("set ray_shadow_decay_range, 2;")
cmd.do("set depth_cue, 0;")
cmd.do("ray;')
${0}
snippet sas
cmd.do("set surface_solvent, ${1:on}')
${0}
snippet ellipcol
cmd.do("set ellipsoid_color, ${1:red};')
${0}
snippet sigdist
cmd.do("set label_distance_digits, ${1:2};')
${0}
snippet sigang
cmd.do("set label_angle_digits, ${1:2};')
${0}
snippet bs
cmd.do("show sticks;")
cmd.do("set stick_radius, 0.12;")
cmd.do("set stick_ball, on;")
cmd.do("set stick_ball_ratio, 1.9;")
cmd.do("show nb_spheres;")
cmd.do("set nb_spheres_size=0.33;')
${0}
snippet stack
cmd.do("delete all;")
cmd.do("fetch ${1:4PCO}, type=pdb,async=0;")
cmd.do("select ${2:G2G3}, ( ((resi ${3:2} or resi ${4:3}) and chain A) or ((resi ${5:8} or resi ${6:9}) and chain B) );")
cmd.do("hide everything, element h; ")
cmd.do("remove not ${2:G2G3};")
cmd.do("bg_color white;")
cmd.do("show sticks;")
cmd.do("set stick_radius=0.14;")
cmd.do("set stick_ball, on; ")
cmd.do("set stick_ball_ratio,1.9;")
cmd.do("set_view (-0.75,0.09,0.66,-0.2,0.92,-0.35,-0.64,-0.39,-0.67,-0.0,-0.0,-43.7,7. 24,9.55,11.78,29.46,57.91,-20.0);")
cmd.do("hide everything, element H;")
cmd.do("select carbon1, element C and (resi ${4:3} or resi ${5:8}); ")
cmd.do("# select lower base pair;")
cmd.do("select carbon2, element C and (resi ${3:2} or resi ${6:9});")
cmd.do("#select upper base pair;")
cmd.do("color gray70,carbon1;")
cmd.do("color gray10,carbon2;")
cmd.do("space cmyk;")
cmd.do("distance hbond1,/${1:4PCO}//B/U`9/N3,/${1:4PCO}//A/G`2/O6;")
cmd.do("distance hbond2,/${1:4PCO}//B/U`9/O2,/${1:4PCO}//A/G`2/N1;")
cmd.do("distance hbond3,/${1:4PCO}//A/U`3/N3,/${1:4PCO}//B/G`8/O6;")
cmd.do("distance hbond4,/${1:4PCO}//A/U`3/O2,/${1:4PCO}//B/G`8/N1;")
cmd.do("color black, hbond1;")
cmd.do("color black, hbond2;")
cmd.do("color gray70, hbond3;")
cmd.do("color gray70, hbond4;")
cmd.do("show nb_spheres;")
cmd.do("set nb_spheres_size, 0.35;")
cmd.do("hide labels;")
cmd.do("ray 1600,1000;")
cmd.do("png ${1:4PCO}.png')
${0}
snippet bu
cmd.do("run ~/${1:Scripts/PyMOLScripts}/quat.py;")
cmd.do("quat;')
${0}
snippet doubleBond
cmd.do("set valence, 1; ")
cmd.do("set valence_mode, 1;')
${0}
snippet cblind
cmd.do("run ~/${1:Pymol-script-repo}/colorblindfriendly.py;")
cmd.do("as cartoon;")
cmd.do("color cb_red, ss H;")
cmd.do("color cb_yellow,ss S;")
cmd.do("color cb_green, ss L+;')
${0}
snippet centerpi
cmd.do("pseudoatom pi_cent,/${1:3nd3}/${2:A}/${3:U`15}/cg+cz;")
cmd.do("dist pi_cent////ps1, b/${4:U`15}/${5:aaa};')
${0}
snippet cribbon
cmd.do("as cartoon;")
cmd.do("color red, ss H;")
cmd.do("color yellow,ss S;")
cmd.do("color green, ss L+;')
${0}
snippet cspheres
cmd.do("as spheres;")
cmd.do("color gray30, chain ${1:A};")
cmd.do("color white, chain ${2:B};")
cmd.do("color green, name CL;")
cmd.do("color brown, resn NAG;")
cmd.do("color red, resi 381;")
cmd.do("remove solvent;")
cmd.do("set specular, 0;")
cmd.do("set ray_trace_gain, 0;")
cmd.do("set ray_trace_mode, 3;")
cmd.do("bg_color white;")
cmd.do("set ray_trace_color, black;")
cmd.do("set depth_cue,0;')
${0}
snippet coordinate
cmd.do("viewport 900,600;")
cmd.do("fetch 3nd4, type=pdb, async=0;")
cmd.do("run ~/Scripts/PyMOLScripts/quat.py;")
cmd.do("quat 3nd4;")
cmd.do("show sticks;")
cmd.do("set stick_radius=0.125;")
cmd.do("hide everything, name H*;")
cmd.do("bg_color white;")
cmd.do("create coorCov, (3nd4_1 and (resi 19 or resi 119 or resi 219 or resi 319 or resi 419 or resi 519 or (resi 3 and name N7)));")
cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/A`3/N7);")
cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`119/O);")
cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`219/O);")
cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`319/O);")
cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`519/O);")
cmd.do("distance (3nd4_1 and chain Aand resi 19 and name NA), (3nd4_1 and chain A and resi 519);")
cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 419);")
cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 319);")
cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 219);")
cmd.do("show nb_spheres; ")
cmd.do("set nb_spheres_size, .35;")
cmd.do("distance hbond1,/3nd4_1/1/A/HOH`119/O, /3nd4_1/1/A/A`3/OP2;")
cmd.do("distance hbond2,/3nd4_1/1/A/HOH`319/O, /3nd4_1/1/A/A`3/OP2;")
cmd.do("distance hbond3,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/HOH`119/O;")
cmd.do("distance hbond4,/3nd4_1/1/A/G`4/N7,/3nd4_1/1/A/HOH`91/O;")
cmd.do("distance hbond5,/3nd4_1/1/A/G`4/O6, /3nd4_1/1/A/HOH`419/O;")
cmd.do("distance hbond6,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/G`4/OP2;")
cmd.do("distance hbond7,/3nd4_1/1/A/HOH`319/O,/3nd4_1/1/A/G`2/OP2;")
cmd.do("distance hbond9,/3nd4_1/1/A/HOH`419/O,/3nd4_2/2/A/HOH`74/O;")
cmd.do("distance hbond10,/3nd4_2/2/A/C`15/O2,/3nd4_1/1/A/G`2/N2;")
cmd.do("distance hbond11, /3nd4_2/2/A/C`15/N3,/3nd4_1/1/A/G`2/N1;")
cmd.do("distance hbond12,/3nd4_2/2/A/C`15/N4,/3nd4_1/1/A/G`2/O6;")
cmd.do("distance hbond13, /3nd4_2/2/A/U`14/N3,/3nd4_1/1/A/A`3/N1;")
cmd.do("distance hbond14,3nd4_2/2/A/U`14/O4,/3nd4_1/1/A/A`3/N6;")
cmd.do("distance hbond15, /3nd4_2/2/A/C`13/N4,/3nd4_1/1/A/G`4/O6;")
cmd.do(" distance hbond16,/3nd4_2/2/A/C`13/N3, /3nd4_1/1/A/G`4/N1;")
cmd.do("distance hbond17, /3nd4_1/1/A/G`4/N2,/3nd4_2/2/A/C`13/O2;")
cmd.do("distance hbond18,/3nd4_1/1/A/G`2/N2,/3nd4_2/2/A/C`15/O2;")
cmd.do("distance hbond19,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/G`4/OP2; ")
cmd.do("set depth_cue=0;")
cmd.do("set ray_trace_fog=0;")
cmd.do("set dash_color, black;")
cmd.do("set label_font_id, 5;")
cmd.do("set label_size, 36;")
cmd.do("set label_position, (0.5, 1.0, 2.0);")
cmd.do("set label_color, black;")
cmd.do("set dash_gap, 0.2;")
cmd.do("set dash_width, 2.0;")
cmd.do("set dash_length, 0.2;")
cmd.do("set label_color, black;")
cmd.do("set dash_gap, 0.2;")
cmd.do("set dash_width, 2.0;")
cmd.do("set dash_length, 0.2;")
cmd.do("select carbon, element C;")
cmd.do("color yellow, carbon;")
cmd.do("disable carbon;")
cmd.do("set_view(-0.9,0.34,-0.26,0.33,0.18,-0.93,-0.27,-0.92,-0.28,-0.07,-0.23,-27.83,8.63,19.85,13.2,16.0,31.63,-20.0)')
${0}
snippet distance
cmd.do("# Edit the name for the ditance, the selection criteria for atom 1, and the selection criteria for atom 2.;")
cmd.do("distance ${1:dist3}, ${2:/rcsb074137//B/IOD`605/I`B}, ${3:/rcsb074137//B/IOD`605/I`A};')
${0}
snippet drawHbonds
cmd.do("hide everything, hydrogens;")
cmd.do("hide labels;")
cmd.do("# set the color of the dashed lines representing the H-bond.;")
cmd.do("set dash_color, ${1:black};")
cmd.do("set dash_gap, 0.4;")
cmd.do("set dash_radius, 0.08;')
${0}
snippet carvedIsomesh
cmd.do("delete all;")
cmd.do("# Fetch the coordinates. Need internet connection.")
cmd.do("fetch ${1:4dgr}, async=0;")
cmd.do("# Fetch the electron density map.")
cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;")
cmd.do("# create a selection out of the glycan")
cmd.do("select ${2:LongGlycan}, resi ${3:469:477};")
cmd.do("orient ${2:LongGlycan};")
cmd.do("remove not ${2:LongGlycan};")
cmd.do("remove name H*;")
cmd.do("isomesh 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;")
cmd.do("color density, 2fofcmap; ")
cmd.do("show sticks;")
cmd.do("show spheres;")
cmd.do("set stick_radius, .07;")
cmd.do("set sphere_scale, .19;")
cmd.do("set sphere_scale, .13, elem H;")
cmd.do("set bg_rgb=[1, 1, 1];")
cmd.do("set stick_quality, 50;")
cmd.do("set sphere_quality, 4;")
cmd.do("color gray85, elem C;")
cmd.do("color red, elem O;")
cmd.do("color slate, elem N;")
cmd.do("color gray98, elem H;")
cmd.do("set stick_color, gray50;")
cmd.do("set ray_trace_mode, 1;")
cmd.do("set ray_texture, 2;")
cmd.do("set antialias, 3;")
cmd.do("set ambient, 0.5;")
cmd.do("set spec_count, 5;")
cmd.do("set shininess, 50;")
cmd.do("set specular, 1;")
cmd.do("set reflect, .1;")
cmd.do("set dash_gap, 0;")
cmd.do("set dash_color, black;")
cmd.do("set dash_gap, .15;")
cmd.do("set dash_length, .05;")
cmd.do("set dash_round_ends, 0;")
cmd.do("set dash_radius, .05;")
cmd.do("set_view (0.34,-0.72,0.61,0.8,0.56,0.22,-0.51,0.4,0.77,0.0,0.0,-81.31,44.64,-9.02,58.62,65.34,97.28,-20.0);")
cmd.do("preset.ball_and_stick(\"all\",mode=1);")
cmd.do("draw;')
${0}
snippet fetch2FoFcIsomesh
cmd.do("fetch ${1:3nd4}, ${1:3nd4}_2fofc, type=2fofc, async=0;")
cmd.do("isomesh 2fofcmap, ${1:3nd4}_2fofc, 1, ${1:3nd4}, carve = 1.8;')
${0}
snippet fetchCIF
cmd.do("fetch ${1:3nd4}, type=cif, async=0;')
${0}
snippet fetchFoFc
cmd.do("fetch ${1:3nd4}, ${1:3nd4}_fofc, type=fofc, async=0;')
${0}
snippet filledRing
cmd.do("show sticks;set cartoon_ring_mode, 3;")
cmd.do("set cartoon_ring_finder, 1;")
cmd.do("set cartoon_ladder_mode, 1;")
cmd.do("set cartoon_nucleic_acid_mode, 4;")
cmd.do("set cartoon_ring_transparency, 0.5;")
cmd.do("as cartoon;')
${0}
snippet hbonddash
cmd.do("hide everything, hydrogens;")
cmd.do("hide labels;")
cmd.do("set dash_color, black; ")
cmd.do("set dash_gap, 0.4;")
cmd.do("set dash_radius, 0.08;')
${0}
snippet hidealtloc
cmd.do("select altconf, alt ${1:b} # select B alternative locators;")
cmd.do("hide everything, altconf # hide alt B locators;')
${0}
snippet labelResnResi
cmd.do("label name ca, \"%s%s\" %(one_letter[${1:resn}],${2:resi});')
${0}
snippet labelSS
cmd.do("alter ${1:chain A}, ss=\"${2:helix}\";")
cmd.do("label (%2),\"%3\";')
${0}
snippet loadPDBbs
cmd.do("fetch ${1:3nd3},name=${1:3nd3}, type=pdb, async=0;")
cmd.do("hide (name H*);")
cmd.do("hide lines;")
cmd.do("show sticks;")
cmd.do("set stick_radius, ${2:1.2};")
cmd.do("set nb_sphere_radius, ${3:0.35};")
cmd.do("orient;')
${0}
snippet loadPDBnb
cmd.do("fetch ${1:3nd3}, name=${1:3nd3}, type=pdb, async=0;")
cmd.do("orient;")
cmd.do("set stick_radius, ${2:1.2};")
cmd.do("hide (name H*);")
cmd.do("set nb_sphere_size, ${3:0.35};")
cmd.do("set nb_spheres_quality, ${4:1};")
cmd.do("show nb_spheres;')
${0}
snippet ms
cmd.do("fetch ${1:3nd3}, name=${1:3nd3}, type=pdb, async=0;")
cmd.do("select ${2:temp}, ${1:3nd3} and chain ${4:A};")
cmd.do("run ${5:/Users/blaine-mooers/Scripts/PyMOLScripts/msms_pymol.py};")
cmd.do("calc_msms_area ${2:temp};')
${0}
snippet molscriptRibbon
cmd.do("set cartoon_highlight_color, grey;")
cmd.do("show cartoon;")
cmd.do("set cartoon_flat_sheets, 0;")
cmd.do("set cartoon_smooth_loops, 0;")
cmd.do("set cartoon_fancy_helices, 1;')
${0}
snippet oneLetter
cmd.do("one_leVer%={\"VAL\":\"V\",%\"ILE\":\"I\",%\"LEU\":\"L\",%\"GLU\":\"E\",%\"GLN\":\"Q\",\"ASP\":\"D\",%\"ASN\":\"N\",%\"HIS\":\"H\",%\"TRP\":\"W\",%\"PHE\":\"F\",%\"TYR\":\"Y\",%\"ARG\":\"R\",%\"LYS\":\"K\",%\"SER\":\"S\",%\"THR\":\"T\",%\"MET\":\"M\",%\"ALA\":\"A\",%\"GLY\":\"G\",%\"PRO\":\"P\",%\"CYS\":\"C\"}%')
${0}
snippet pseudolabel
cmd.do("pseudoatom ${1:forLabel};")
cmd.do("label ${1:forLabel}, \"%0\";")
cmd.do("set label_color, ${2:red};')
${0}
snippet rotate
cmd.do("rotate ${1:x}, ${2:45}, ${3:pept};')
${0}
snippet stereoDraw
cmd.do("stereo walleye; ")
cmd.do("set ray_shadow, off; ")
cmd.do("#draw 3200,2000;")
cmd.do("draw ${1:1600,1000}; ")
cmd.do("png ${2:aaa}.png;')
${0}
snippet stereoRay
cmd.do("stereo; ")
cmd.do("set ray_shadow, off;")
cmd.do("ray ${1:2400,1200};")
cmd.do("png ${2:aaa}.png;')
${0}
snippet loadThreeMaps
cmd.do("load ${1:4dgr}.pdb;")
cmd.do("# Make sure to rename map file so that;")
cmd.do("# the root filename differs from pdb root filename;")
cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;")
cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;")
cmd.do("select ${2:glycan}, resid 200 or (resid 469:477);")
cmd.do("isomesh ${3:mesh1}, 2fofc, 1.0, ${2:glycan};")
cmd.do("color density, ${3:mesh1};")
cmd.do("isomesh ${4:mesh2}, fofc, 3.0, ${2:glycan};")
cmd.do("color green, ${4:mesh2};")
cmd.do("isomesh ${5:mesh3}, fofc, -3.0, ${2:glycan};")
cmd.do("color red, ${5:mesh3};')
${0}
snippet turnAboutAxis
cmd.do("turn ${1:x},${2:90};')
${0}
snippet volumeRamp
cmd.volume_ramp_new("ramp_magenta", [0.01, 1.00, 0.00, 1.00, 0.00, 4.01, 1.00, 0.00, 1.00, 0.10, 4.99, 1.00, 0.00, 1.00, 0.50,])
${0}
snippet solventRadius
cmd.do("set solvent_radius, ${1:1.55};')
${0}
snippet rv
cmd.do("run roundview.py;')
${0}
snippet spse
cmd.do("python;")
cmd.do("import datetime;")
cmd.do("from pymol import cmd; ")
cmd.do("DT =datetime.datetime.now().strftime(\"yr%Ymo%mday%dhr%Hmin%M\");")
cmd.do("s = str(DT); ")
cmd.do("cmd.save(stemName+s+\".pse\"); ")
cmd.do("python end;')
${0}
snippet sc222
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 2, 2, 2, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet pearl
cmd.do("create ${1:sodium2}, ${2:sodium1};")
cmd.do("set sphere_transparency, 0.4, ${1:sodium2};")
cmd.do("set sphere_scale, 1.05, ${1:sodium2};")
cmd.do("ray;')
${0}
snippet fog
cmd.do("set fog, 0;')
${0}
snippet rmwater
cmd.do("remove resn HOH;')
${0}
snippet setcolor
cmd.do("set_color ${1:bark}, [${2:0.1, ${3:0.1}, ${4:0.1}];")
cmd.do("color ${1:bark}, ${5:protein};')
${0}
snippet duplicateObject
cmd.do("create ${1:t4l}, ${2:1lw9};')
${0}
snippet selectChain
cmd.do("select ${1:rna}, ${2:chain B};')
${0}
snippet selectResidues
cmd.do("select aromatic, resn phe+tyr+trp;')
${0}
snippet selectResi
cmd.do("select ${!:se}; resi ${2: 1:100};')
${0}
snippet selectElement
cmd.do("select ${1:oxygen}, elem ${2:O};')
${0}
snippet selectName
cmd.do("select ${1:oxygen2}, name ${2:O2};')
${0}
snippet selectHelices
cmd.do("select ${1:helices}, ss h; ')
${0}
snippet selectStrands
cmd.do("select ${1:strands}, ss s; ')
${0}
snippet selectLoops
cmd.do("select ${1:loops}, ss l;')
${0}
snippet selectAllBut
cmd.do("select ${1:select1}, elem ${2:N} and chain ${3:A} and not resn ${4:LYS};')
${0}
snippet selectAtomsAround
cmd.do("select ${1:nearby}, resn ${2:drug} around ${3:5};')
${0}
snippet selectResiduesAround
cmd.do("select ${1:nearby}, br. resn ${2:drug} around ${3:5};')
${0}
snippet undoSelection
cmd.do("disable ${1:sele}; ')
${0}
snippet loadPDBfile
cmd.do("load ${1:my}.pdb;')
${0}
snippet savePNG
cmd.do("png ${1:saveMe}.png, ${2:1920}, ${3:1920}, ${4:600}, ${5:1};')
${0}
snippet ringMode
cmd.do("show cartoon, ${1:rna}; set cartoon_ring_mode, ${2:3};')
${0}
snippet sidehChainHelper
cmd.do("set cartoon_side_chain_helper, on;')
${0}
snippet extractPartObj
cmd.do("extract new_obj, chain A;')
${0}
snippet puttyCartoon
cmd.do("show cartoon;")
cmd.do("cartoon putty;")
cmd.do("set cartoon_smooth_loops, 0;")
cmd.do("set cartoon_flat_sheets, 0;")
cmd.do("set cartoon_smooth_loops,0;")
cmd.do("## unset cartoon_smooth_loops;')
${0}
snippet hideSelection
cmd.do("indicate none')
${0}
snippet discreteCartoonColoring
cmd.do("set cartoon_discrete_colors, on;')
${0}
snippet sc111
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet saxsEnvelope
cmd.do("alter ${1:refine_A_Ave_SM_015_0_370-374-0r}, vdw=3.0;")
cmd.do("set solvent_radius = 3.0;')
${0}
snippet setpath
os.environ["PATH"] += os.pathsep +${1: "~/ATSAS-3.0.3-1/bin"};
${0}
snippet fetchPath
cmd.do("set fetch_path, ${1:/Users/blaine/pdbFiles};')
${0}
snippet antialias
cmd.do("set antialias, 1;')
${0}
snippet sigDigits
cmd.do("set label_distance_digits, ${1:2};")
cmd.do("set label_angle_digits, ${2:2};')
${0}
snippet labelCAs
cmd.do("label name CA,\"%s%s\" % (resn,resi);')
${0}
snippet labelWatersHOH
cmd.do("label resn HOH ,\"%s%s\" % (resn,resi);')
${0}
snippet labelWatersW
cmd.do("label resn HOH ,\"W%s\" % (resi);')
${0}
snippet findHbonds
cmd.do("remove element h; distance hbonds, all, all, 3.2, mode=2;')
${0}
snippet printBs
cmd.do("remove element h; iterate resi ${1: 1:13}, print(resi, name,b);')
${0}
snippet labelMainChain
cmd.do("label name n+c+o+ca,\"%s%s%s\" % (resn,resi,name);')
${0}
snippet printBspartB
cmd.do("iterate resi ${1:38} and altloc ${2:B}, print resi, name, alt, b;')
${0}
snippet printBs2digits
cmd.do("iterate (resi ${1:133}), print(name + \" %.2f\" % b);')
${0}
snippet writeCommandReference2HTML
cmd.write_html_ref("pymol-command-ref.html");
${0}
snippet averageB
cmd.do("Bfactors = []; ")
cmd.do("# >>> edit the selection below, which is a range of residue numbers here.;")
cmd.do("iterate (resi ${1:133}), Bfactors.append(b);")
cmd.do("print(\"Sum = \", \"%.2f\" % (sum(Bfactors)));")
cmd.do("print(\"Number of atoms = \", len(Bfactors));")
cmd.do("print( \"Average B =\" , \"%.2f\" % ( sum(Bfactors)/float(len(Bfactors))));')
${0}
snippet printNameB4ResiX
Bfac_dict = { "Bfactors3" : [] };
cmd.iterate("(${1:resi 133})","Bfactors3.append((name, b))", space=Bfac_dict);
[print("%s %.2f" % (i,j)) for i,j in Bfac_dict["Bfactors3"];
${0}
snippet printResiResnNameB4ResiX
Bfac_dict = { "Bfactors3" : [] };
cmd.iterate("(${1:resi 133})","Bfactors3.append((resn,resi,name, b))", space=Bfac_dict);
[print("%s %s %s %.2f" % (i,j,k,l)) for i,j,k,l in Bfac_dict["Bfactors3"]]
${0}
snippet printResiResnNameB4ResiXNoH
Bfac_dict = { "Bfactors3" : [] };
cmd.iterate("(${1:resi 133} and not elem H)","Bfactors3.append((resn,resi,name, b))", space=Bfac_dict);
[print("%s %s %s %.2f" % (i,j,k,l))for i,j,k,l in Bfac_dict["Bfactors3"]];
${0}
snippet internalGUImode2
cmd.do("internal_gui_mode=2;')
${0}
snippet internalGUIwidth
cmd.do("set internal_gui_width=${1:0};')
${0}
snippet printDoc
print(${1:my_func}.__doc__);
${0}
snippet his31asp70
cmd.do("fetch ${1:1lw9}, async=0; ")
cmd.do("zoom (${2:resi 31 or resi 70}); ")
cmd.do("preset.technical(selection=\"all\"); ")
cmd.do("bg_color ${3:gray70}; ")
cmd.do("clip slab, 7,(${4:resi 31 or resi 70});")
cmd.do("rock;')
${0}
snippet waterTriple
cmd.do("fetch ${1:lw9}, async=0; ")
cmd.do("zoom resi ${2:313}; ")
cmd.do("preset.technical(selection=\"all\", mode=1);')
${0}
snippet ligandSelect
cmd.do("select ${1:ligand}, organic;')
${0}
snippet github
cmd.do("https://github.com/MooersLab/pymolsnips/blob/master/README.md')
${0}
snippet sigdihedral
cmd.do("set label_dihedral_digits, ${1:2};')
${0}
snippet stateOne
cmd.create("newobject", "oldobject", "1", "1");
${0}
snippet sc112
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 2, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc113
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 3, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc311
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 3, 1, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc131
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 3, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc211
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 2, 1, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc121
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 2, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc122
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 2, 2, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc221
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 2, 2, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc212
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 2, 1, 2, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc133
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 3, 3, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc313
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 3, 1, 3, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc331
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 3, 3, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc233
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 2, 3, 3, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc323
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc332
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 3, 3, 2, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc333
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 3, 3, 3, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc114
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 4, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc141
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 4, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sc411
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 4, 1, 1, , ${2:orange}, ${3:supercell1}, 1;')
${0}
snippet sccp4
cmd.do("python;")
cmd.do("import datetime;")
cmd.do("from pymol import cmd; ")
cmd.do("DT =datetime.datetime.now().strftime(\"yr%Ymo%mday%dhr%Hmin%M\");")
cmd.do("s = str(DT); ")
cmd.do("cmd.save(stemName+s+\".ccp4\"); ")
cmd.do("python end;')
${0}
snippet sdae
import datetime;
DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M");
s = str(DT);
cmd.save(stemName+s+".dae");
${0}
snippet carvedIsosurface
cmd.do("delete all;")
cmd.do("# Fetch the coordinates. Need internet connection.;")
cmd.do("fetch ${1:4dgr}, async=0;")
cmd.do("# Fetch the electron density map.;")
cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;")
cmd.do("# create a selection out of the glycan;")
cmd.do("select ${2:LongGlycan}, resi ${3:469:477};")
cmd.do("orient ${2:LongGlycan};")
cmd.do("remove not ${2:LongGlycan};")
cmd.do("remove name H*;")
cmd.do("isosurface 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;")
cmd.do("color density, 2fofcmap; ")
cmd.do("show sticks;")
cmd.do("show spheres;")
cmd.do("set stick_radius, .07;")
cmd.do("set sphere_scale, .19;")
cmd.do("set sphere_scale, .13, elem H;")
cmd.do("set bg_rgb=[1, 1, 1];")
cmd.do("set stick_quality, 50;")
cmd.do("set sphere_quality, 4;")
cmd.do("color gray85, elem C;")
cmd.do("color red, elem O;")
cmd.do("color slate, elem N;")
cmd.do("color gray98, elem H;")
cmd.do("set stick_color, gray50;")
cmd.do("set ray_trace_mode, 1;")
cmd.do("set ray_texture, 2;")
cmd.do("set antialias, 3;")
cmd.do("set ambient, 0.5;")
cmd.do("set spec_count, 5;")
cmd.do("set shininess, 50;")
cmd.do("set specular, 1;")
cmd.do("set reflect, .1;")
cmd.do("set dash_gap, 0;")
cmd.do("set dash_color, black;")
cmd.do("set dash_gap, .15;")
cmd.do("set dash_length, .05;")
cmd.do("set dash_round_ends, 0;")
cmd.do("set dash_radius, .05;")
cmd.do("set_view (0.34,-0.72,0.61,0.8,0.56,0.22,-0.51,0.4,0.77,0.0,0.0,-81.31,44.64,-9.02,58.62,65.34,97.28,-20.0);")
cmd.do("preset.ball_and_stick(\"all\",mode=1);")
cmd.do("draw;')
${0}
snippet fetch2FoFcIsosurface
cmd.do("fetch ${1:3nd4}, ${1:3nd4}_2fofc, type=2fofc, async=0;")
cmd.do("isosurface 2fofcmap, ${1:3nd4}_2fofc, 1, ${1:3nd4}, carve = 1.8;')
${0}
snippet threeMapsIsosurface
cmd.do("load ${1:4dgr}.pdb;")
cmd.do("# Make sure to rename map file so that ;")
cmd.do("# the root filename differs from pdb root filename;")
cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;")
cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;")
cmd.do("select ${2:glycan}, ${3:resid 200 or (resid 469:477)};")
cmd.do("isosurface ${4:mesh1}, 2fofc, 1.0, ${2:glycan};")
cmd.do("color density, ${4:mesh1};")
cmd.do("isosurface ${5:mesh2}, fofc, 3.0, ${2:glycan};")
cmd.do("color green, ${5:mesh2};")
cmd.do("isosurface ${6:mesh3}, fofc, -3.0, ${2:glycan};")
cmd.do("color red, ${6:mesh3};')
${0}
snippet carvedVolume
cmd.do("delete all;")
cmd.do("# Fetch the coordinates. Need internet connection.;")
cmd.do("fetch ${1:4dgr}, async=0;")
cmd.do("# Fetch the electron density map.;")
cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;")
cmd.do("# create a selection out of the glycan;")
cmd.do("select ${2:LongGlycan}, resi ${3:469:477};")
cmd.do("# oreint the long axes of the object along the x-axis;")
cmd.do("orient ${2:LongGlycan};")
cmd.do("# remove everything except the glycan;")
cmd.do("remove not ${2:LongGlycan};")
cmd.do("# remove the remaining hydrogen atoms;")
cmd.do("remove name H*;")
cmd.do("# show the electron density map as a surface.")
cmd.do("surface 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;")
cmd.do("color density, 2fofcmap; ")
cmd.do("show sticks;")
cmd.do("show spheres;")
cmd.do("set stick_radius, .07;")
cmd.do("set sphere_scale, .19;")
cmd.do("set sphere_scale, .13, elem H;")
cmd.do("set bg_rgb=[1, 1, 1];")
cmd.do("set stick_quality, 50;")
cmd.do("# make the spheres smooth with larger settings.;")
cmd.do("set sphere_quality, 4;")
cmd.do("# gray85 is off-white, gray0 is black;")
cmd.do("color gray85, elem C;")
cmd.do("color red, elem O;")
cmd.do("color slate, elem N;")
cmd.do("color gray98, elem H;")
cmd.do("set stick_color, gray50;")
cmd.do("set ray_trace_mode, 1;")
cmd.do("set ray_texture, 2;")
cmd.do("set antialias, 3;")
cmd.do("set ambient, 0.5;")
cmd.do("set spec_count, 5;")
cmd.do("set shininess, 50;")
cmd.do("set specular, 1;")
cmd.do("set reflect, .1;")
cmd.do("set dash_gap, 0;")
cmd.do("set dash_color, black;")
cmd.do("set dash_gap, .15;")
cmd.do("set dash_length, .05;")
cmd.do("set dash_round_ends, 0;")
cmd.do("set dash_radius, .05;")
cmd.do("set_view (0.34,-0.72,0.61,0.8,0.56,0.22,-0.51,0.4,0.77,0.0,0.0,-81.31,44.64,-9.02,58.62,65.34,97.28,-20.0);")
cmd.do("preset.ball_and_stick(\"all\",mode=1);")
cmd.do("draw;')
${0}
snippet fetch2FoFcVolume
cmd.do("fetch ${1:3nd4}, type=cif, async=0;")
cmd.do("fetch ${1:3nd4}, {1:3nd4}_2fofc, type=2fofc, async=0;")
cmd.do("# Render and display a contour of this map as a volume around a selection called LongGlycan.;")
cmd.do("volume 2fofcmap, ${1:3nd4}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;')
${0}
snippet threeMapsVolume
cmd.do("load ${1:4dgr}.pdb;")
cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;")
cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;")
cmd.do("select ${2:glycan}, ${3:resid 200 or (resid 469:477)};")
cmd.do("volume ${4:mesh1}, 2fofc, 1.0, ${2:glycan};")
cmd.do("color density, ${4:mesh1};")
cmd.do("volume ${5:mesh2}, fofc, 3.0, ${2:glycan};")
cmd.do("color green, ${5:mesh2};")
cmd.do("volume ${6:mesh3}, fofc, -3.0, ${2:glycan};")
cmd.do("color red, ${6:mesh3};')
${0}
snippet rvi
def rvj(StoredView=0, decimal_places=2, outname="roundedview.txt"):
"""
rvj() is a modification of the the rv() function (aka the roundview.py)
so that it can run in Jupyter notebooks with the ipymol.viewer.
A set_view string is printed to the noteobook in a format that is ready
for reuse.
The ipymol module was developed by Carlos Hernandez:
https://github.com/cxhernandez/ipymol
The pre-requisites for installing ipymol are as follows:
1. Make a jupyter notebook kernel for Python interpreter inside of
the Schrodinger PyMOL. See the PyMOL Snippets GitHub Page for
a description of how to make one.
2. Install the following build of ipymol at the PyMOL prompt.
You need to log into your GitHub account first.
pip install git+pip install git+https://github.com/cxhernandez/ipymol.git@2a30d6ec1588434e6f0f72a1d572444f89ff535b
3. Make a bash alias to this PyMOL app file.
4. Launch the jupyter notebook and select the pymol.python kernel.
5. Open a terminal instance from the File pulldown in jupyter notebook.
6. Enter `pymol -Rq` to launch an interactive instance of PyMOL.
7. Enter the following code to load ipymol and conmect to PyMOL
from ipymol import viewer as ipv
ipv.start() # Start PyMOL RPC server
Now you can change the scene manually and send the display as static
image to a cell in the jupyter notebook.
It is assumed that the viewer class of the ipymol moduel has been
imported as ipv.
I made the following modifications of roundview.py.
The cmd.get_view was replaced with ipv.get_view.
The cmd.extend was replaced with ipv.extend.
The myRoundedList was returned for further processing.
MIT License
Copyright:
Blaine Mooers and the OU Board of Regents
University of Oklahoma Health Sciences Center
Oklahoma City, OK 73104
29 April 2020
"""
StoredView = int(StoredView)
decimal_places = int(decimal_places)
#call the get_view function
m = ipv.get_view(StoredView)
#Make a list of the elements in the orientation matrix.
myList = [m[0], m[1], m[2], m[3], m[4], m[5], m[6],m[7], m[8], m[9],
m[10], m[11], m[12], m[13], m[14],m[15], m[16], m[17]]
#Round off the matrix elements to two decimal places (two fractional places)
#This rounding approach solved the problem of unwanted
#whitespaces when I tried to use a string format statement
myRoundedList = [round(elem, decimal_places) for elem in myList]
#x is the string template for the output. The whitespace is required
#between the "set_view" and "("
x = "set_view ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17});"
# Print to the command history window.
print(x.format(*myRoundedList))
#Write to a text file.
myFile = open("roundedview.txt", "a")
myFile.write(x.format(*myRoundedList) + "")
myFile.close()
return myRoundedList
${0}
snippet rdkrpcChem
import os;
import rdkit;
from rdkit import Chem;
from rdkit.Chem import AllChem;
from rdkit.Chem import PyMol;
s = PyMOL.MolViewer();
mol = Chem.MolFromSmiles("${1:CCOCCn1c(C2CC[NH+](CCc3ccc(C(C)(C)C(=O)[O-])cc3)CC2)nc2ccccc21}");
mol = AllChem.AddHs(mol);
AllChem.EmbedMolecule(mol);
AllChem.MMFFOptimizeMolecule(mol);
s.ShowMol(mol, name = "${2:bilastine}", showOnly = False);
s.Zoom("${2:bilastine}");
s.SetDisplayStyle("${2:bilastine}", "sticks");
s.GetPNG(preDelay=5);
${0}
snippet kernel
{
"argv": [
"/Applications/PyMOL.app/Contents/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "pymol.python",
"language": "python"
}
${0}
snippet rdkrpcProtein
from rdkit.Chem import PyMol;
Usage=""""Start pymol from command line with -R flag.
Select the pymol.python kernel in Jupyter notebook. """;
s = PyMol.MolViewer();
du = s.server.do;
du("rein; bg_color white; fetch ${1:1lw9}, type=pdb, async=0, show;nb_spheres;set_view (${2:0.46,-0.28,-0.84,0.74,-0.41,0.54,-0.49,-0.87,0.02,0.0,0.0,-155.16,35.13,11.48,9.72,122.33,187.99,-20.0});");
s.GetPNG(preDelay=3);
du("png ${3:T4L600dpi}.png, dpi=600");
${0}
snippet ipymolStart
from ipymol import viewer as ipv;
ipv.start() # Start PyMOL RPC server;
${0}
snippet ipymolProtein
from ipymol import viewer as ipv;
# Start PyMOL RPC server;
ipv.start();
ipv.do("fetch ${1:1lw9}");
ipv.do("rv");
ipv.set_view((-0.13,-0.4,-0.91,0.89,-0.45,0.07,-0.44,-0.8,0.41,0.0,0.0,-182.47,35.13,11.48,9.72,149.64,215.3,-20.0));
ipv.do("AOD");
ipv.png("${2:testipymolT4L}.png");
${0}
snippet rvr
def rvr(StoredView=0, decimal_places=2, outname="roundedview.txt"):
"""MIT License
Copyright:
Blaine Mooers and the OU Board of Regents
University of Oklahoma Health Sciences Center
Oklahoma City, OK 73104
30 April 2020
First run the following:
from rdkit.Chem import PyMol
s = PyMol.MolViewer()
du = s.server.do
"""
StoredView = int(StoredView) decimal_places = int(decimal_places)
#call the get_view function
m = s.get_view(StoredView)
#Make a list of the elements in the orientation matrix.
myList = [m[0], m[1], m[2], m[3], m[4], m[5], m[6],m[7], m[8], m[9],
m[10], m[11], m[12], m[13], m[14],m[15], m[16], m[17]]
#Round off the matrix elements to two decimal places (two fractional places)
#This rounding approach solved the problem of unwanted
#whitespaces when I tried to use a string format statement
myRoundedList = [round(elem, decimal_places) for elem in myList]
#x is the string template for the output. The whitespace is required
#between the "set_view" and "("
x = "set_view ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17});"
# Print to the command history window.
print(x.format(*myRoundedList))
#Write to a text file.
myFile = open("roundedview.txt", "a") myFile.write(x.format(*myRoundedList) + "") myFile.close()
return myRoundedList
${0}
snippet cmddocs
[help(i) for i in dir(cmd)];
${0}
snippet pymoldocs
[help(i) for i in dir(pymol)];
${0}
snippet numResiProtein
sel = "polymer.protein"; print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom])));
${0}
snippet numResiProteinChainA
sel = "${1:chain A} and polymer.protein"; print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom])));
${0}
snippet numResiNucleic
sel = "polymer.nucleic";
[print(len(set([(i.resi, i.resn) for i in cmd.get_model(sel).atom])))];
${0}
snippet numResiNucleicChainA
sel = "${1:chain A} and polymer.nucleic";
[print(len(set([(i.resi, i.resn) for i in cmd.get_model(sel).atom])))];
${0}
snippet brokenNucleicBackbone
[cmd.bond(f"/${1:5fur}//${2:E}/{i}/O3"", f"/${1:5fur}//${2:E}/{i+1}/P") for i in range(${5:1}, ${6:80})];
[cmd.bond(f"/${1:5fur}//${2:F}/{i}/O3"", f"/${1:5fur}//${2:F}/{i+1}/P") for i in range(${7:81}, ${8:160})];
${0}
snippet oneBondThicknessColor
cmd.do("set_bond stick_color, ${1:yellow}, index 2, index 3;")
cmd.do("set_bond stick_radius, ${2:0.2}, index 2, index 3;')
${0}
snippet drawLinks
cmd.do("draw_links ${1:mol1} & chain ${2:A} & name ${3:CA} & resi ${4:1+6+7+8}, ${5:mol1} & chain ${6:A}& name ${7:CA} & resi ${8:10+16+17+18};')
${0}
snippet printPath
print(pymol.__path__)
${0}
snippet setLigandValenceOn
cmd.do("set valence, on, resn ${1:RZS}; set valence, off, not resn ${2:RZS};')
${0}