-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython.snippets
3178 lines (3178 loc) · 185 KB
/
python.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
# reticulate
snippet reticulate
```{r}
library(reticulate)
use_condaenv("r-reticulate")
```${0}
# python code block
snippet pythonCodeBlock
```{python}
${1:enter code here}
```
# Apply the ambient occlussion effect to get the photorealistic effect.
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}
# Show the solvent excluded surface.
snippet sas
cmd.do("set surface_solvent, ${1:on}")
${0}
# Set color of thernal ellipsoids. The PDB must have anisotopic temperature factors. See https://pymolwiki.org/index.php/Color_Values for the PyMOL colors.
snippet ellipcol
cmd.do("set ellipsoid_color, ${1:red};")
${0}
# Set distance labels to display 2 decimals.
snippet sigdist
cmd.do("set label_distance_digits, ${1:2};")
${0}
# Set angle labels to display 2 decimals places.
snippet sigang
cmd.do("set label_angle_digits, ${1:2};")
${0}
# Ball and stick representation.
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}
# Base-stacking figure.
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}
# Generate the biological unit using the quat.py script. Edit the path to the file quat.py. You may have to download it from the PyMOL Wiki page.
snippet bu
cmd.do("run ~/${1:Scripts/PyMOLScripts}/quat.py;")
cmd.do("quat;")
${0}
# Valence bond.
snippet doubleBond
cmd.do("set valence, 1; ")
cmd.do("set valence_mode, 1;")
${0}
# Apply color blind friendly to ribbon diagrams. Edit the path to the Pymol-script-repo in your computer account. See PyMOL wiki for more information about the Pymol-script-reo.
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}
# Center pi. Edit the atoms selected for positioning the pseudoatom.
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}
# Color ribbon H red, strand yellow, loop green.
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}
# Colored spheres.
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}
# Coordinate covalent bonds to metals and H-bonds from RNA.
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}
# H-bond distance between a H-bond donor and acceptor. Edit the name for the ditance, the selection criteria for atom 1, and the selection criteria for atom 2.
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}
# Display H-bonds as dashes colored black.
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}
# Carved isomesh representation of electron density.
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}
# Fetch 2FoFc map as an isomesh.
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}
# Fetch the atomic coordinates as a cif file from the PDB.
snippet fetchCIF
cmd.do("fetch ${1:3nd4}, type=cif, async=0;")
${0}
# Fetch fofc map from the PDB.
snippet fetchFoFc
cmd.do("fetch ${1:3nd4}, ${1:3nd4}_fofc, type=fofc, async=0;")
${0}
# Filled rings in nucleic acids.
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}
# Get coordinates.
snippet getCoordinates
cmd.do("print cmd.get_atom_coords(\\\"${1:/4PCO//B/G`8/OP2}\\\");")
${0}
# Set up H-bond dashes.
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}
# Hide the partially occupied atoms with the part b alternate locator.
snippet hidealtloc
cmd.do("select altconf, alt ${1:b} # select B alternative locators;")
cmd.do("hide everything, altconf # hide alt B locators;")
${0}
# Label CA atom with single-letter residue name and residue number.
snippet labelResnResi
cmd.do("label name ca, \"%s%s\" %(one_letter[${1:resn}],${2:resi});")
${0}
# Label SS.
snippet labelSS
cmd.do("alter ${1:chain A}, ss=\"${2:helix}\";")
cmd.do("label (%2),\"%3\";")
${0}
# Load PDB ball-and-stick.
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}
# Load PDB nb spheres.
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}
# Measure surface area of the selection with the msms_pymol.py script.
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}
# Show cartoon in the style of Molscript ribbons.
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}
# Switch from three letter code to one-letter code for amino acids.
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}
# Print Fasta from PDB file.
snippet fasta
cmd.do("print cmd.get_fastastr(\"all\")")
${0}
# Position label with pseudoatom.
snippet pseudolabel
cmd.do("pseudoatom ${1:forLabel};")
cmd.do("label ${1:forLabel}, \"%0\";")
cmd.do("set label_color, ${2:red};")
${0}
# Rotate a selection about and axis by a given angle.
snippet rotate
cmd.do("rotate ${1:x}, ${2:45}, ${3:pept};")
${0}
# Stereo draw.
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}
# Stereo ray.
snippet stereoRay
cmd.do("stereo; ")
cmd.do("set ray_shadow, off;")
cmd.do("ray ${1:2400,1200};")
cmd.do("png ${2:aaa}.png;")
${0}
# Three electron density as Isomesh.
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}
# Turn about axis.
snippet turnAboutAxis
cmd.do("turn ${1:x},${2:90};")
${0}
# Volume ramp.
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,])"
# Set radius of ball used to make solvent accessible surface.
snippet solventRadius
cmd.do("set solvent_radius, ${1:1.55};")
${0}
# Scale the radius and color of atoms as spheres by property in the B-value column.
snippet scaleRadiusColor
cmd.do("bg_color white;")
cmd.do("hide everything;")
cmd.do("show spheres;")
cmd.do("set stick_radius = 0.1;")
cmd.do("hide everything, HET;")
cmd.do("show spheres, HET;")
cmd.do("set sphere_quality=3;")
cmd.do("show sticks, resi ${1:1102};")
cmd.do("from pymol import stored;")
cmd.do("# set the stored array equal to the b−values or use your own values; ")
cmd.do("stored.bb = [ ];")
cmd.do("iterate all, stored.bb.append(b);")
cmd.do("# execute a python−block;")
cmd.do("python;")
cmd.do("# scale the b−values;")
cmd.do("M = max(stored.bb);")
cmd.do("scaledBB = map(lambda x: float (x/M), stored.bb);")
cmd.do("count = 0;")
cmd.do("# set the sphere radii independently;")
cmd.do("#[(cmd.set(\"sphere_scale\", x ,\"ID %s\"%count); count = count + 1) for x in scaledBB];")
cmd.do("for x in scaledBB:")
cmd.do(" cmd.set(\"sphere_scale\", x ,\"ID %s\"%count)")
cmd.do(" count = count + 1")
cmd.do("python end;")
cmd.do("spectrum b, selection=${2:4gdx};")
cmd.do("space cmyk;")
cmd.do("set specular_intensity , 0.25;")
${0}
# Return settings in rounded format.
snippet rv
cmd.do("run roundview.py;")
${0}
# Save png flle with timestamp.
snippet spng
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+\".png\"); ")
cmd.do("python end;")
${0}
# Save pse flle with timestamp
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}
# Run supercell script to generate three cells in all directions. This script was written by Thomas Holder.
snippet sc222
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 2, 2, 2, , ${2:orange}, ${3:supercell1}, 1;")
${0}
# The pearl effect is made with two spheres with the outer sphere being transparent.
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}
# Blur the background atoms.
snippet fog
cmd.do("set fog, 0;")
${0}
# Remove waters from molecular object.
snippet rmwater
cmd.do("remove resn HOH;")
${0}
# Set color name to a RGB code.
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}
# Duplicate object. Create an object with the first argument using the selection, which is the second argument.
snippet duplicateObject
cmd.do("create ${1:t4l}, ${2:1lw9};")
${0}
# Select a chain.
snippet selectChain
cmd.do("select ${1:rna}, ${2:chain B};")
${0}
# Select residues by name.
snippet selectResidues
cmd.do("select aromatic, resn phe+tyr+trp;")
${0}
# Select residues by a range of numbers.
snippet selectResi
cmd.do("select ${!:se}; resi ${2: 1:100};")
${0}
# Select atoms by element.
snippet selectElement
cmd.do("select ${1:oxygen}, elem ${2:O};")
${0}
# Select atoms by name.
snippet selectName
cmd.do("select ${1:oxygen2}, name ${2:O2};")
${0}
# Select atoms by alpha helices.
snippet selectHelices
cmd.do("select ${1:helices}, ss h; ")
${0}
# Select atoms by beta strands.
snippet selectStrands
cmd.do("select ${1:strands}, ss s; ")
${0}
# Select atoms by beta loops.
snippet selectLoops
cmd.do("select ${1:loops}, ss l;")
${0}
# Select all nitrogen atom in a selelction except from lysine.
snippet selectAllBut
cmd.do("select ${1:select1}, elem ${2:N} and chain ${3:A} and not resn ${4:LYS};")
${0}
# Select atoms within a radius around a ligand.
snippet selectAtomsAround
cmd.do("select ${1:nearby}, resn ${2:drug} around ${3:5};")
${0}
# Select residues within a radius around a ligand.
snippet selectResiduesAround
cmd.do("select ${1:nearby}, br. resn ${2:drug} around ${3:5};")
${0}
# Undo a selection.
snippet undoSelection
cmd.do("disable ${1:sele}; ")
${0}
# Load a pdb file in the current directory.
snippet loadPDBfile
cmd.do("load ${1:my}.pdb;")
${0}
# Save a png file of current scene to the current directory. PyMOL writes out only png files. This file may need to be converted to a tiff file. See the png2tiff snippet for a bash script that converts all png files in a folder into tiff files. 1: png filename. 2: x-dimension in pixels. 3: y-dimension in pixels, 1600 x 1000 approximates the golden ratio. Usually want a square for multipanel figures..4: dots per inch. 5: ray tracing off, 0; ray tracing on, 1 should also consider image without ray tracing shadows.
snippet savePNG
cmd.do("png ${1:saveMe}.png, ${2:1920}, ${3:1920}, ${4:600}, ${5:1};")
${0}
# Set the ring mode to a value between 0 and 6 in cartoons of nucleic acids.
snippet ringMode
cmd.do("show cartoon, ${1:rna}; set cartoon_ring_mode, ${2:3};")
${0}
# In cartoons, hide the backbone atoms of selected residues when showing then as sticks.
snippet sidehChainHelper
cmd.do("set cartoon_side_chain_helper, on;")
${0}
# Create a new object from part of an existing object.
snippet extractPartObj
cmd.do("extract new_obj, chain A;")
${0}
# Create a putty cartoon. The command may be needed if the above setting does not work. This can happen if using the presets. The command below may be needed if the above setting does not work.This can happen if using the presets. The command below may be needed if the above setting does not work. This can happen if using the presets.
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}
# Turn off magenta squares on current selection.
snippet hideSelection
cmd.do("indicate none")
${0}
# Turn on discrete colors between secondary structure elements.
snippet discreteCartoonColoring
cmd.do("set cartoon_discrete_colors, on;")
${0}
# Display all symmetry mates in one unit cell. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. Change to your path to supercell.py.
snippet sc111
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 1, , ${2:orange}, ${3:supercell1}, 1;")
${0}
# Display SAXS envelope. Edit to enter the name of the bead model object.
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}
# Set additional path for PyMOL to search on startup.
snippet setpath
os.environ[\"PATH\"] += os.pathsep +${1: \"~/ATSAS-3.0.3-1/bin\"};"
# Set path for location to save fetched pdb files.
snippet fetchPath
cmd.do("set fetch_path, ${1:/Users/blaine/pdbFiles};")
${0}
# Set antialias to on to get smoother edges.
snippet antialias
cmd.do("set antialias, 1;")
${0}
# Print list of active pymolrc files.
snippet lspymolrc
cmd.do("print invocation.options.deferred;")
${0}
# Set number of decimals places to show in distance labels.
snippet sigDigits
cmd.do("set label_distance_digits, ${1:2};")
cmd.do("set label_angle_digits, ${2:2};")
${0}
# Label the CA atoms with the Ala333 style format.
snippet labelCAs
cmd.do("label name CA,\"%s%s\" % (resn,resi);")
${0}
# Label waters with HOH and their residue number.
snippet labelWatersHOH
cmd.do("label resn HOH ,\"%s%s\" % (resn,resi);")
${0}
# Label waters with W and their reisude number.
snippet labelWatersW
cmd.do("label resn HOH ,\"W%s\" % (resi);")
${0}
# Find H-bonds around a residue.
snippet findHbonds
cmd.do("remove element h; distance hbonds, all, all, 3.2, mode=2;")
${0}
# Print the B-factors of a residue.
snippet printBs
cmd.do("remove element h; iterate resi ${1: 1:13}, print(resi, name,b);")
${0}
# Label the main chain atoms with the following: resn,resi,atom name.
snippet labelMainChain
cmd.do("label name n+c+o+ca,\"%s%s%s\" % (resn,resi,name);")
${0}
# Print B factors of part B of a residue.
snippet printBspartB
cmd.do("iterate resi ${1:38} and altloc ${2:B}, print resi, name, alt, b;")
${0}
# Print B--factors for a residue with the B-factors rounded off to two decimal places.
snippet printBs2digits
cmd.do("iterate (resi ${1:133}), print(name + \" %.2f\" % b);")
${0}
# Write the command reference to html file in the present working directory.
snippet writeCommandReference2HTML
cmd.write_html_ref(\"pymol-command-ref.html\");"
# Average the B-factors by using a regular list as opposed to a stored list in PyMOL. Edit the selection as needed.
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}
# Prints the residue number and the average bfactor. Uses reduce and lambda, builtin Python functional porgramming functions. Note that you need to convert the length of the list of Bfactors from an integer to a float before division into the sum.
snippet aveB4resiX
cmd.do("Bfactors = [];")
cmd.do("iterate (resi ${1:133}), Bfactors.append(b);")
cmd.do("print( \"Average B-factor of residue \", %{1:133} , \" = \", \"%.2f\" %(reduce(lambda x, y: x + y, Bfactors) / float(len(Bfactors))) );")
${0}
# Print name and b-factor for a residue.
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\"];"
# Print resn, resi, atom name, and b-factor.
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\"]]"
# Print name and b-factor for a residue or residue range (e.g. 81:120). The noH variant.
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\"]];"
# Make the background of the internal gui transparent to expand viewport.
snippet internalGUImode2
cmd.do("internal_gui_mode=2;")
${0}
# Set the width of the internal gui. Set to 0 to make the internal gui vanish.
snippet internalGUIwidth
cmd.do("set internal_gui_width=${1:0};")
${0}
# Print document string of a function.
snippet printDoc
print(${1:my_func}.__doc__);"
# List all snips by tab trigger and description.
snippet lsSnips
cmd.do("\"\"\"Name Description ,")
cmd.do("------------------------------------------------------------------------------------------------------------------------------------------------------------------------,")
cmd.do("AO Run the AO function from the pymolshortcuts.py file to generate the photorealistic effect.")
cmd.do("AOBW Run the AOBW function from the pymolshortcuts.py file to generate photorealistic effect in grayscale.")
cmd.do("AOD Run the AOD function from the pymolshortcuts.py file to generate photorealistic effect with carbons colored black.")
cmd.do("AODBW Run the AODBW function from the pymolshortcuts.py file to generate photorealistic effect with carbons colored black and all other atoms colored in grayscale.")
cmd.do("PE125 Run the PE125 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.125 of the van der Waals surface.")
cmd.do("PE25 Run the PE25 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.25 of the van der Waals surface.")
cmd.do("PE33 Run the PE33 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.33 of the van der Waals surface.")
cmd.do("PE50 Run the PE50 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.50 of the van der Waals surface.")
cmd.do("PE66 Run the PE66 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.66 of the van der Waals surface.")
cmd.do("PE75 Run the PE75 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.75 of the van der Waals surface.")
cmd.do("PE85 Run the PE85 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.85 of the van der Waals surface.")
cmd.do("addAxis Adds the function draw_axis(). Used to draw a symmetry axis, a ncs axis, or scale bar to a scene.")
cmd.do("addAxispy Adds the function draw_axis(). Could be useful for the adding a symmery axis, a ncs axis, or scale bar to a scene.")
cmd.do("allPairs This is a two-fold nested list comprehension for any all-parwise operation on the currently loaded objects. Replace optAlginRNA with object from any other function that operations on a pair of structrures.")
cmd.do("antialias Set antialias to on to get smoother edges.")
cmd.do("ao Apply the ambient occlussion effect to get the photorealistic effect.")
cmd.do("ao Apply the ambient occlussion effect to get the photorealistic effect.")
cmd.do("aobw Ambient occlussion in grayscale.")
cmd.do("aod Ambient occlussion with carbon atoms colored black.")
cmd.do("aodbw Ambient occlussion in grayscale with carbon atoms colored black. Note: requires the gscale() function from pymolshortcuts.py. Download this script from http://GitHub.com/MooersLab/pymolshortcuts. Load the functions from this script with the following command: cmd.do('run pymolshortcuts.py').")
cmd.do("aveB4resiX Prints the residue number and the average bfactor. Uses reduce and lambda, builtin Python functional porgramming functions. Note that you need to convert the length of the list of Bfactors from an integer to a float before division into the sum.")
cmd.do("aveB4resiXpy AveBResiX, prints the residue number and the average bfactor. Uses reduce and lambda, builtin Python functional porgramming functions. Note that you need to convert the length of the list of Bfactors from an integer.")
cmd.do("averageB Average the B-factors by using a regular list as opposed to a stored list in PyMOL. Edit the selection as needed. ")
cmd.do("basePairStacking This code make as standard base stacking diagram with ball and stick representation.")
cmd.do("brokenNucleicBackbone Create bonds between phosphorous and O3* atoms in a low-resolution DNA structure that is 80 base pairs long. Edit the selections below, which are ranges of residue numbers and edit the molecular object name (5fur).")
cmd.do("bs Ball and stick representation.")
cmd.do("bsfr Ball-and-stick plus filled ring representation for ligands.")
cmd.do("bu Generate the biological unit using the quat.py script. Edit the path to the file quat.py. You may have to download it from the PyMOL Wiki page.")
cmd.do("carvedIsomesh Carved isomesh representation of electron density.")
cmd.do("carvedIsosurface Carved isosurface representation of electron density.")
cmd.do("carvedVolume Carved volume representation of electron density.")
cmd.do("cav Run the cav function from the pymolshortcuts.py file to show buried cavities and pockets as molecular surfaces.")
cmd.do("cblind Apply color blind friendly to ribbon diagrams. Edit the path to the Pymol-script-repo in your computer account. See PyMOL wiki for more information about the Pymol-script-reo.")
cmd.do("cblindCartoon Color cartoon with colorblind friendly colors. Requires that the pymolshortcuts.py file is loaded. This has been applied to PDB-ID 7JU6. The protein is human RET kinase, and the drug is selpercatinib, a FDA approved drug for treating several cancers.")
cmd.do("centerpi Center pi. Edit the atoms selected for positioning the pseudoatom.")
cmd.do("cmddocs Print in the command history window the docstrings of all of the functions in the cmd module.")
cmd.do("cntccp4emaps Count number of *.ccp4 (electron density map) files in current directory.")
cmd.do("cntfiles Count number of files in current directory.")
cmd.do("cntlogs Count number of *.log files in current directory.")
cmd.do("cntmtzs Count number of *.mtz files in current directory.")
cmd.do("cntpdbs Count number of *.pdb files in current directory.")
cmd.do("cntpmls Count number of *.pml files in current directory.")
cmd.do("cntpngs Count number of *.png files in current directory.")
cmd.do("cntpses Count number of *.pse files in current directory.")
cmd.do("colorh1 Run the colorh1 function from the pymolshortcuts.py file to color protein molecules according to the Eisenberg hydrophobicity scale, scheme 1.")
cmd.do("colorh2 Run the colorh2 function from the pymolshortcuts.py file to color protein molecules according to the Eisenberg hydrophobicity scale, scheme 2.")
cmd.do("coordinate Coordinate covalent bonds to metals and H-bonds from RNA.")
cmd.do("cribbon Color ribbon H red, strand yellow, loop green.")
cmd.do("cring Colored ring.")
cmd.do("cspheres Colored spheres.")
cmd.do("discreteCartoonColoring Turn on discrete colors between secondary structure elements.")
cmd.do("displayFonts Print to the screen as labels the 21 font ids in their corresponding fonts in a grid. Each label is an object and appears in the internal gui. You can turn on and off the display of specific fonts.")
cmd.do("displayFontspy Print to the screen as labels the 21 font ids in their corresponding fonts in a grid. Each label is an object and appears in the internal gui. You can turn on and off the display of specific fonts.")
cmd.do("distance H-bond distance between a H-bond donor and acceptor. Edit the name for the ditance, the selection criteria for atom 1, and the selection criteria for atom 2.")
cmd.do("doubleBond Valence bond.")
cmd.do("drawHbonds Display H-bonds as dashes colored black.")
cmd.do("drawLinks Connect the alpha carbons of residue 1 with 10, 6 with 16, 7 with 17 and 8 with 18. Note that this example requires the draw_links.py [http://pldserver1.biochem.queensu.ca/~rlc/work/pymol/draw_links.py] by Robert Campbell.")
cmd.do("dssrBlock1 Combining DSSR block representation with regular PyMOL cartoons after loading the dssr_block.py script by Thomas Holder.")
cmd.do("dssrBlock2 DSSR block representation with fused blocks after loading the dssr_block.py script by Thomas Holder. The x3dna-dssr executable needs to be in the PATH.")
cmd.do("dssrBlock3 DSSR block representation for a multi-state example after loading the dssr_block.py script by Thomas Holder. The x3dna-dssr executable needs to be in the PATH. Edit the path to Thomas Holder's block script.")
cmd.do("dssrBlock4 DSSR block representation with custom coloring after loading the dssr_block.py script by Thomas Holder. The x3dna-dssr executable needs to be in the PATH.")
cmd.do("duplicateObject Duplicate object. Create an object with the first argument using the selection, which is the second argument.")
cmd.do("ellipcol Set color of thernal ellipsoids. The PDB must have anisotopic temperature factors. See https://pymolwiki.org/index.php/Color_Values for the PyMOL colors.")
cmd.do("emacsjupyterSourceBlock Source block template in org-mode with emacs-jupyter package.")
cmd.do("extractPartObj Create a new object from part of an existing object.")
cmd.do("fasta Print Fasta from PDB file.")
cmd.do("fastapy Python version of the command to print the sequence from a PDB file in the fasta format.")
cmd.do("fetch2FoFcIsomesh Fetch 2FoFc map as an isomesh.")
cmd.do("fetch2FoFcIsosurface Fetch 2FoFc map as an isosurface. Edit the PDB-ID code. Use lowercase letter for the fifth character to select a single chain. Render and display a contour of this map as a chicken wire representation.")
cmd.do("fetch2FoFcVolume Fetch 2FoFc map as a volume.")
cmd.do("fetchCIF Fetch the atomic coordinates as a cif file from the PDB.")
cmd.do("fetchFoFc Fetch fofc map from the PDB.")
cmd.do("fetchPath Set path for location to save fetched pdb files.")
cmd.do("fetchThreeMaps Display three electron density maps as isomesh.")
cmd.do("filledRing Filled rings in nucleic acids.")
cmd.do("findHbonds Find H-bonds around a residue.")
cmd.do("fog Blur the background atoms.")
cmd.do("getCoordinates Get coordinates.")
cmd.do("getCoordinatespy Python version of getCoordinates snippets. Note that the python2 print statement stills works in pml scripts.")
cmd.do("github Print url of README.md file of the pymolsnips repository.")
cmd.do("grayscale Apply grayscale coloring using a grayscale version of the PyMOL colors for the elements. This is a Python function. It is invoked in a script file via grayscale(). There is a corresponding gscale shortcut in pymolshortcuts.py that is invoked in a pml script by entering gsale if the functions in pymolshortcuts.py have been loaded with the run pymolshortcuts.py command.")
cmd.do("grayscalepy Apply grayscale coloring using a grayscale version of the PyMOL colors for the elements. This is a Python function. It is invoked in a script file via gscale(). There is a corresponding gscale shortcut in pymolshortcuts.py that is invoked in a pml script by entering gsale if the functions in pymolshortcuts.py have been loaded with the run pymolshortcuts.py command.")
cmd.do("hb Creates an object of all H-bonds found by PyMOL.")
cmd.do("hbonddash Set up H-bond dashes.")
cmd.do("helpDocs Return the docstring for the help submodule. This command is more concise: help help.")
cmd.do("hideSelection Turn off magenta squares on current selection.")
cmd.do("hidealtloc Hide the partially occupied atoms with the part b alternate locator.")
cmd.do("his31asp70 Display the famous Asp70-His31 salt-bridge from T4 lysozyme that contributes3-5 kcal/mol to protein stability. ")
cmd.do("importIPythonDisplay Imports for using IPython to display images loaded from disk in notebook cells.")
cmd.do("importPyMOLandShortcuts Imports needed for most users of PyMOL in Jupyter. Combination of importPyMOL and importPythonDisplay.")
cmd.do("importPyMOLcmd Import the cmd class from the pymol api.")
cmd.do("importShortcuts Import for loading the functions in the pymolshortcuts.py file. These functions can be run inside cmd.do() without the trailing (). For example, cmd.do('rv').")
cmd.do("imports4PyMOLjupyter Imports needed for most uses of pymol in Jupyter. Combination of importPyMOL and importPythonDisplay.")
cmd.do("internalGUImode2 Make the background of the internal gui transparent to expand viewport.")
cmd.do("internalGUIwidth Set the width of the internal gui. Set to 0 to make the internal gui vanish.")
cmd.do("ipymolProtein Demo of the use of the RPC server with a protein via ipymol. Create a kernel for python interpreter from PyMOL inside Jupyter. See the kernel snippet for an example. See the README.md file on pymolsnips GItHub website or more details https://github.com/MooersLab/pymilsnips. Start pymol in terminal with pymol -R. Select pymol.python as kernel in Juptyer. The double parentheses are required when set_view is run this way.;")
cmd.do("ipymolStart Code to start the RPC server with ipymol. Start pymol in terminal with pymol -R; select pymol.python as the kernel in juptyer. You may have to create this kernel for the Python interpreter that is inside PyMOL.")
cmd.do("kernel A kernel.json file for runnig PyMOL python interpreter in the Jupyter notebook. This code should reside in a folder named pymol.python in the ~/Library/Jupyter/kernels.")
cmd.do("labelCAs Label the CA atoms with the Ala333 style format.")
cmd.do("labelMainChain Label the main chain atoms with the following: resn,resi,atom name.")
cmd.do("labelResnResi Label CA atom with single-letter residue name and residue number.")
cmd.do("labelSS Label SS.")
cmd.do("labelWatersHOH Label waters with HOH and their residue number.")
cmd.do("labelWatersW Label waters with W and their reisude number.")
cmd.do("ligandSelect Make selection of ligand atoms.")
cmd.do("listLigandProteinDistances Print a list of protein--ligand distances. Code by Dan Kulp. Updated for Python3.")
cmd.do("listObjects Create a list of objects in the internal gui and print this list to the screen.")
cmd.do("listSettings Print to the screen the settings and their current parameter values. This is the more compact version.")
cmd.do("listSettings2 Print to the screen the settings and their current parameter values.")
cmd.do("loadAmberTrajs The amber trajectories have to be loaded into the same object.")
cmd.do("loadAndAlignManyFiles1 These are the instructions for loading and aligning multiple files. To save multiple models in a file to separate pdb files.")
cmd.do("loadAndAlignManyFiles2 To align all of the loaded RNA structures in all possible combinations by their C1' carbon atoms. Yes, this construct is a list comprehension inside a list comprehension!")
cmd.do("loadAndAlignManyFiles3 These are the instructions for loading and aligning multiple files.")
cmd.do("loadImage Load image.")
cmd.do("loadManyFiles Load into PyMOL multiple files with a common file stem. The is a script by Robert Campbell that has been updated for Python3.")
cmd.do("loadPDBbs Load PDB ball-and-stick.")
cmd.do("loadPDBfile Load a pdb file in the current directory.")
cmd.do("loadPDBnb Load PDB nb spheres.")
cmd.do("loadThreeMaps Three electron density as Isomesh.")
cmd.do("lsSnips List all snips by tab trigger and description.")
cmd.do("lsSnipsPy List all snips by tab trigger and description.")
cmd.do("lspymolrc Print list of active pymolrc files.")
cmd.do("lspymolrcpy Print list of active pymolrc files.")
cmd.do("molscriptRibbon Show cartoon in the style of Molscript ribbons.")
cmd.do("ms Measure surface area of the selection with the msms_pymol.py script.")
cmd.do("nmr Show all models in a nmr structure.")
cmd.do("nmroff Hide all but first model in a nmr structure.")
cmd.do("nmroffpy Hide all but the first model in a nmr structure.")
cmd.do("nmrpy Show all models in a nmr structure.")
cmd.do("nucleicAcidBackboneTubesSticks This code shows the cartoon backbone tube as 65% transparent. It hides the rungs of the cartoon. It shows all of the non-H atoms are sticks. The motivation is to have the cartoon highlight the backbone without dominanting the scene.")
cmd.do("nucleicAcidCartoon Settings for nucliec acid cartoon. The dark blue used for electron density maps is called `density`. The cartoon_ladder_radius should be renamed the cartoon_rung_radius. The dimensions are in Angstroms.")
cmd.do("nucleicAcidCartoon2Strands Coloring two strand differently of a double helix makes it easier to for the viewer to distinguish the two strands. The set command has the syntax of setting_name [, setting_value [, selection [,state ]]] . In this case, the selection has to be global, object, object-state, or per-atom settings. It cannot be a named selection. This is a weak spot in PyMOL. Coloring two strand differently of a double helix makes it easier to for the viewer to distinguish the two strands. Many double-stranded helices have one strand in the asymmetric unit. The second strand is in the biological unit. The coordinates for the second strand are in the pdb1 file type at the PDB. The second strand is in the second state, which is equivalent to the second model in the pdb file. The strands are labeled chain A and B (via the cartoon_nucliec_acid_color setting). The bases are colored differently too (via the cartoon_ladder_color setting).")
cmd.do("nucleicAcidCartoonFilledRings The code provides a cartoon of the loaded nucleic acid that has the ladder rungs replaced by filled rings that are colored by atom type. The code can be applied to any nucleic acid. It is derived from the FR shortuct in pymolshortcuts.py.")
cmd.do("nucleicAcidColorbySequence This code colors the nucleotides by base seqence. It can be applied to any nucleic acid.")
cmd.do("nucleicAcidDumbellCartoonColorbySequence This code colors by the nucleotides by base seqence. The backcone is shown as a flatten ribbon with rolled edges that give the dumbell effect. The code can be applied to any nucleic acid. The code is dervied from the CR and DU shortcuts.")
cmd.do("nucleicAcidFlatRibbonColorbySequence This code colors the nucleotides by base seqence. It can be applied to any nucleic acid. It is dervied from the CR shortcut. The backcone is shown as a flatten ribbon.")
cmd.do("numResiNucleic Print the number of residues in a nulceic acid (all chains).")
cmd.do("numResiNucleicChainA Print the number of residues in a nulceic acid chain.")
cmd.do("numResiProtein Print the number of residues in a protein.")
cmd.do("numResiProteinChainA Print the number of residues in chain A of a protein.")
cmd.do("obipythonSourceBlock Source block template in org-mode with the ob-ipython package.")
cmd.do("oneBondThicknessColor To change stick color and radius for the bond between atom 2 and 3, use the set_bond command.")
cmd.do("oneLetter Switch from three letter code to one-letter code for amino acids.")
cmd.do("optAlignRNA OptiAlign.py by Jason Vertree modified for aligning multiple RNA structures.")
cmd.do("pearl The pearl effect is made with two spheres with the outer sphere being transparent.")
cmd.do("presetDocs Return the docstring for the preset submodule. The command help preset fails to return anything. The command help(pymol.preset) has the same effect as help(preset).")
cmd.do("printAtomNames Print the atom names of a residue.")
cmd.do("printAtomNumbers Print the atom name and number of a residue.")
cmd.do("printBfactors Print the bfactors of a residue.")
cmd.do("printBs Print the B-factors of a residue.")
cmd.do("printBs2digits Print B--factors for a residue with the B-factors rounded off to two decimal places.")
cmd.do("printBspartB Print B factors of part B of a residue.")
cmd.do("printColorByAtomCodes Print the codes for color-by-atom (util.cba*) alternates.")
cmd.do("printCoordinates Print the coordinates of the atoms in a residue.")
cmd.do("printDoc Print document string of a function.")
cmd.do("printDocpy Print document string of a function.")
cmd.do("printNameB4ResiX Print name and b-factor for a residue.")
cmd.do("printNamesCoordinates Print the atom names and coordinates of the atoms in a residue.")
cmd.do("printNamesCoordinates Print the atom names as tuples and coordinates of the atoms in a residue as a list.")
cmd.do("printPath Print the path to the currently used PyMOL binary.")
cmd.do("printPathpy Print the path to the currently used PyMOL binary.")
cmd.do("printResiResnNameB4ResiX Print resn, resi, atom name, and b-factor. ")
cmd.do("printResiResnNameB4ResiXNoH Print name and b-factor for a residue or residue range (e.g. 81:120). The noH variant.")
cmd.do("printVDWradii Print the van der Waals radii of the atoms in of a residue.")
cmd.do("pseudolabel Position label with pseudoatom.")
cmd.do("puttyCartoon Create a putty cartoon. The command may be needed if the above setting does not work. This can happen if using the presets. The command below may be needed if the above setting does not work.This can happen if using the presets. The command below may be needed if the above setting does not work. This can happen if using the presets.")
cmd.do("pymoldocs Return to the command history window the docstrings for all of the functions in a module.")
cmd.do("pymoldocspy Return to the command history window the docstrings for all of the functions in a module.")
cmd.do("rdkrpcChem Demo of the use of the RPC server with a drug compound via the rdkit python module.")
cmd.do("rdkrpcProtein Demo of the use of the RPC server with a protein via rdkit.")
cmd.do("renameChain Rename a chain. ")
cmd.do("renumAtoms Add or substract a atom number offset.")
cmd.do("renumResi Add or substract a residue number offset.")
cmd.do("ringMode Set the ring mode to a value between 0 and 6 in cartoons of nucleic acids.")
cmd.do("rmd Remove all measurement objects in the interal GUI.")
cmd.do("rmhb Delete all H-bonds in the selection, which is all by default.")
cmd.do("rmwater Remove waters from molecular object.")
cmd.do("rotate Rotate a selection about and axis by a given angle.")
cmd.do("rv Return settings in rounded format.")
cmd.do("rvi Return settings in rounded format while running PyMOL via the RCP server ipymol in a jupyter notebook. This is a modified version of the roundview.py script.")
cmd.do("rvr Return settings in rounded format while running PyMOL via the RCP server rdkit in a jupyter notebook. This is a modified version of the roundview.py script.")
cmd.do("saln Save an aln flle with a timestamp.")
cmd.do("salnpy Save an aln flle with a timestamp. Python version.")
cmd.do("sas Show the solvent excluded surface.")
cmd.do("savePNG Save a png file of current scene to the current directory. PyMOL writes out only png files. This file may need to be converted to a tiff file. See the png2tiff snippet for a bash script that converts all png files in a folder into tiff files. 1: png filename. 2: x-dimension in pixels. 3: y-dimension in pixels, 1600 x 1000 approximates the golden ratio. Usually want a square for multipanel figures..4: dots per inch. 5: ray tracing off, 0; ray tracing on, 1 should also consider image without ray tracing shadows. ")
cmd.do("saveSeppy Saves multiple objects into multiple files using an optional prefix name.")
cmd.do("saxsEnvelope Display SAXS envelope. Edit to enter the name of the bead model object.")
cmd.do("sc111 Display all symmetry mates in one unit cell. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. Change to your path to supercell.py.")
cmd.do("sc112 Display all symmetry mates in two unit cells along the c axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc113 Display all symmetry mates in three unit cels along c. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc114 Display all symmetry mates in four unit cells stacked long c-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc121 Display all symmetry mates in two unit cells along the b axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc122 Display all symmetry mates in a 1 x 2 x 2 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc131 Display all symmetry mates in three unit cells along b. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc133 Display all symmetry mates in 1 x 3 x 3 array of unit cell. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc141 Display all symmetry mates in four unit cells stacked long b-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc144 Display all symmetry mates in in a 1 x 4 x 4 array. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc211 Display all symmetry mates in two unit cell along a. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc212 Display all symmetry mates in a 2 x 1 x 2 arrays of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc221 Display all symmetry mates in 2 x 2 x 1 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc222 Run supercell script to generate three cells in all directions. This script was written by Thomas Holder.")
cmd.do("sc233 Display all symmetry mates in a 2 x 3 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc311 Display all symmetry mates three three unit cells along a. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc313 Display all symmetry mates in a 3 x 1 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc323 Display all symmetry mates in a 3 x 2 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc331 Display all symmetry mates in 3 x 3 x 1 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc332 Display all symmetry mates in 3 x 3 x 2 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc333 Display all symmetry mates in 3 x 3 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc411 Display all symmetry mates in four unit cells stacked long a-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc414 Display all symmetry mates in a 4 x 1 x 4 array. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc441 Display all symmetry mates in four unit cells stacked long a-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc444 Display all symmetry mates in a 4 x 4 x4 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("sc444 Display all symmetry mates in a 4 x 4 x4 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.")
cmd.do("scaleRadiusColor Scale the radius and color of atoms as spheres by property in the B-value column.")
cmd.do("scaleRadiusColorPythonInsertpy Python block insert for scaleRadiusColorpy.")
cmd.do("scaleRadiusColorpy Scale the radius and color of atoms as spheres by property in the B-value column.")
cmd.do("sccp4 Save electron density map flle with timestamp.")
cmd.do("sccp4py Save electron density map flle with timestamp.")
cmd.do("sdae Save dae flle with timestamp.")
cmd.do("sdaepy Save dae flle with timestamp.")
cmd.do("selectAllBut Select all nitrogen atom in a selelction except from lysine.")
cmd.do("selectAtomsAround Select atoms within a radius around a ligand.")
cmd.do("selectChain Select a chain.")
cmd.do("selectElement Select atoms by element.")
cmd.do("selectHelices Select atoms by alpha helices.")
cmd.do("selectLoops Select atoms by beta loops.")
cmd.do("selectName Select atoms by name.")
cmd.do("selectResi Select residues by a range of numbers.")
cmd.do("selectResidues Select residues by name.")
cmd.do("selectResiduesAround Select residues within a radius around a ligand.")
cmd.do("selectStrands Select atoms by beta strands.")
cmd.do("setLigandValenceOn Display the bond valence of ligands only.")
cmd.do("setcolor Set color name to a RGB code.")
cmd.do("setpath Set additional path for PyMOL to search on startup.")
cmd.do("sidehChainHelper In cartoons, hide the backbone atoms of selected residues when showing then as sticks.")
cmd.do("sigDigits Set number of decimals places to show in distance labels.")
cmd.do("sigang Set angle labels to display 2 decimals places.")
cmd.do("sigdihedral Set dihedral labels to display 2 decimals places to the right of the decimal point.")
cmd.do("sigdist Set distance labels to display 2 decimals.")
cmd.do("solventRadius Set radius of ball used to make solvent accessible surface.")
cmd.do("spng Save png flle with timestamp.")
cmd.do("spngpy Save png flle with timestamp.")
cmd.do("spse Save pse flle with timestamp")
cmd.do("stack Base-stacking figure.")
cmd.do("stateOne Select state 1 from a model with multiple states.")
cmd.do("stereoDraw Stereo draw.")
cmd.do("stereoRay Stereo ray.")
cmd.do("stereokb Set keyboard shortcut by mapping F1 to stereo.")
cmd.do("symexp The code expands the asymmetric unit. It like the generate symmetry mates command but it provides more control over the prefix name of the symmetry mates and the addition of unique segment identifiers for each symmetry mate. The usage: symexp prefix, object, (selection), cutoff, segidFlag. The cutoff is in Angstroms. The segidFlag set to 1 will add unique segids. For related functions, see SC***.")
cmd.do("synch Wait until all current commands have been executed. A timeout ensures that that command ecentually returns.")
cmd.do("threeMapsIsosurface Display three electron density maps as isosurfaces.")
cmd.do("threeMapsVolume Three electron density as volumes. Make sure to rename map file so that the root filename differs from pdb root filename.")
cmd.do("timcolor Run the timcolor function from the pymolshortcuts.py file to color atoms accordings to Tim Mather's biophysical coloring scheme for proteins.")
cmd.do("turnAboutAxis Turn about axis.")
cmd.do("undoSelection Undo a selection.")
cmd.do("unitCellEdgesColorBlack Color unit cell edges black. The settings for controlling the unit cell color are hard to find.")
cmd.do("volumeRamp Volume ramp.")
cmd.do("wallart Reset hash_max from 100 to 2000 to enable the saving of 28 inches by 28 inches.")
cmd.do("wallartpy Reset hash_max from 100 to 2000 to enable the saving of 28 inches by 28 inches.")
cmd.do("waterTriple Examples of a triple water pentagon. Zoom in on the selection. Edit by changing the residue number.")
cmd.do("writeCommandReference2HTML Write the command reference to html file in the present working directory. ")
cmd.do("yrb Run the yrb function from the pymolshortcuts.py file. ")
cmd.do("------------------------------------------------------------------------------------------------------------------------------------------------------------------------\"\"\"")
${0}
# Display the famous Asp70-His31 salt-bridge from T4 lysozyme that contributes3-5 kcal/mol to protein stability.
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}
# Examples of a triple water pentagon. Zoom in on the selection. Edit by changing the residue number.
snippet waterTriple
cmd.do("fetch ${1:lw9}, async=0; ")
cmd.do("zoom resi ${2:313}; ")
cmd.do("preset.technical(selection=\"all\", mode=1);")
${0}
# Make selection of ligand atoms.
snippet ligandSelect
cmd.do("select ${1:ligand}, organic;")
${0}
# Print url of README.md file of the pymolsnips repository.
snippet github
cmd.do("https://github.com/MooersLab/pymolsnips/blob/master/README.md")
${0}
# Set dihedral labels to display 2 decimals places to the right of the decimal point.
snippet sigdihedral
cmd.do("set label_dihedral_digits, ${1:2};")
${0}
# Select state 1 from a model with multiple states.
snippet stateOne
cmd.create(\"newobject\", \"oldobject\", \"1\", \"1\");"
# Display all symmetry mates in two unit cells along the c axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.
snippet sc112
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 2, , ${2:orange}, ${3:supercell1}, 1;")
${0}
# Display all symmetry mates in three unit cels along c. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.
snippet sc113
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 1, 1, 3, , ${2:orange}, ${3:supercell1}, 1;")
${0}
# Display all symmetry mates three three unit cells along a. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.
snippet sc311
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")
cmd.do("supercell 3, 1, 1, , ${2:orange}, ${3:supercell1}, 1;")
${0}
# Display all symmetry mates in three unit cells along b. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.
snippet sc131
cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;")