├── LICENSE ├── README.md └── pymolpy.snips /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Blaine Mooers and the University of Oklahoma Board of Regents 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Version](https://img.shields.io/static/v1?label=jupyter-neosnippets-pymolpysnips&message=0.1&color=brightcolor) 2 | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) 3 | 4 | # jupyter-neosnippets-pymolpysnips 5 | PyMOL Python snippet library to edit live Jupyter notebook cells with Vim or Neovim using the neosnippets plugin and the browser plugin GhostText 6 | 7 | ## Installation 8 | 9 | I assume that the `neosnippets` plugin has already been properly installed. 10 | The snippets are stored in a single file called `pymolpy.snips`. 11 | I store this file in a folder called `~/.vim/my-snippets/neosnippets`. 12 | 13 | ## Note 14 | 15 | Some snippets depend on some pymolshortcuts. 16 | Add the [pymolshortcuts.py](https://github.com/MooersLab/pymolshortcuts) file to your working directory. 17 | 18 | ## Related repos 19 | 20 | - [jupyterlabpymolpysnips](https://github.com/MooersLab/jupyterlabpymolpysnips) PyMOL Python snippets for use in JupyterLab with the jupyterlab-snippets extension. 21 | - [jupyternbclassicpymolpysnipsplus](https://github.com/MooersLab/jupyternbclassicpymolpysnipsplus) 22 | - [taggedpymolpysnips](https://github.com/MooersLab/taggedpymolpysnips) 23 | - [taggedpymolpysnipspymolpysnipsplus](https://github.com/MooersLab/taggedpymolpysnipspymolpysnipsplus) 24 | - [jupyter-vsc-pymolpysnips](https://github.com/MooersLab/jupyter-vsc-pymolpysnips) 25 | - [jupyter-st3-pymolpysnips](https://github.com/MooersLab/jupyter-st3-pymolpysnips) 26 | - [jupyter-emacs-pymolpysnips](https://github.com/MooersLab/jupyter-emacs-pymolpysnips) 27 | - [jupyter-ultisnips-pymolpysnips](https://github.com/MooersLab/jupyter-ultisnips-pymolpysnips) 28 | - [jupyter-snipmate-pymolpysnips](https://github.com/MooersLab/jupyter-snipmate-pymolpysnips) 29 | - [jupyter-neosnippets-pymolpysnips](https://github.com/MooersLab/jupyter-neosnippets-pymolpysnips) 30 | - [jupyter-atom-pymolpysnips](https://github.com/MooersLab/jupyter-atom-pymolpysnips) 31 | -------------------------------------------------------------------------------- /pymolpy.snips: -------------------------------------------------------------------------------- 1 | snippet ao 2 | abbr ao 3 | alias ao 4 | cmd.do("set_color oxygen, [1.0,0.4,0.4];") 5 | cmd.do("set_color nitrogen, [0.5,0.5,1.0];") 6 | cmd.do("remove solvent;") 7 | cmd.do("as spheres;") 8 | cmd.do("# the \"as\" command is a shortcut for show_as") 9 | cmd.do("util.cbaw;") 10 | cmd.do("# \"cba\" represents \"color by atom\". ") 11 | cmd.do("# The last letter represents the colore of the carbon atom.") 12 | cmd.do("bg white;") 13 | cmd.do("# bg is an alias for bg_color or background color.") 14 | cmd.do("set light_count,10;") 15 | cmd.do("# light_count is the number of light sources. ") 16 | cmd.do("# The max is 10. The defualt is 10.") 17 | cmd.do("set spec_count,1;") 18 | cmd.do("# Not documented on Wiki.") 19 | cmd.do("set shininess, 10;") 20 | cmd.do("# sets the shininess of the object.") 21 | cmd.do("set specular,0.25;") 22 | cmd.do("# Controls the amount of directly reflected light and not the shininess of the reflection.") 23 | cmd.do("set ambient,0;") 24 | cmd.do("# Controls the amount of ambient light. Default is 0. Ranges from -1 to 1.") 25 | cmd.do("set direct,0; ") 26 | cmd.do("# Not documented on Wiki.") 27 | cmd.do("set reflect,1.5;") 28 | cmd.do("# Controls the amount of light reflection and the effect that directional light has on shadows ") 29 | cmd.do("# and the general lighting of the scene. Default value is 0.5.") 30 | cmd.do("set ray_shadow_decay_factor, 0.1;") 31 | cmd.do("set ray_shadow_decay_range, 2;") 32 | cmd.do("set depth_cue, 0;") 33 | cmd.do("ray;") 34 | $0 35 | 36 | snippet sas 37 | abbr sas 38 | alias sas 39 | cmd.do("set surface_solvent, ${1:on}") 40 | $0 41 | 42 | snippet ellipcol 43 | abbr ellipcol 44 | alias ellipcol 45 | cmd.do("set ellipsoid_color, ${1:red};") 46 | $0 47 | 48 | snippet sigdist 49 | abbr sigdist 50 | alias sigdist 51 | cmd.do("set label_distance_digits, ${1:2};") 52 | $0 53 | 54 | snippet sigang 55 | abbr sigang 56 | alias sigang 57 | cmd.do("set label_angle_digits, ${1:2};") 58 | $0 59 | 60 | snippet bs 61 | abbr bs 62 | alias bs 63 | cmd.do("show sticks;") 64 | cmd.do("set stick_radius, 0.12;") 65 | cmd.do("set stick_ball, on;") 66 | cmd.do("set stick_ball_ratio, 1.9;") 67 | cmd.do("show nb_spheres;") 68 | cmd.do("set nb_spheres_size=0.33;") 69 | $0 70 | 71 | snippet stack 72 | abbr stack 73 | alias stack 74 | cmd.do("delete all;") 75 | cmd.do("fetch ${1:4PCO}, type=pdb,async=0;") 76 | 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) );") 77 | cmd.do("hide everything, element h; ") 78 | cmd.do("remove not ${2:G2G3};") 79 | cmd.do("bg_color white;") 80 | cmd.do("show sticks;") 81 | cmd.do("set stick_radius=0.14;") 82 | cmd.do("set stick_ball, on; ") 83 | cmd.do("set stick_ball_ratio,1.9;") 84 | 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);") 85 | cmd.do("hide everything, element H;") 86 | cmd.do("select carbon1, element C and (resi ${4:3} or resi ${5:8}); ") 87 | cmd.do("# select lower base pair;") 88 | cmd.do("select carbon2, element C and (resi ${3:2} or resi ${6:9});") 89 | cmd.do("#select upper base pair;") 90 | cmd.do("color gray70,carbon1;") 91 | cmd.do("color gray10,carbon2;") 92 | cmd.do("space cmyk;") 93 | cmd.do("distance hbond1,/${1:4PCO}//B/U`9/N3,/${1:4PCO}//A/G`2/O6;") 94 | cmd.do("distance hbond2,/${1:4PCO}//B/U`9/O2,/${1:4PCO}//A/G`2/N1;") 95 | cmd.do("distance hbond3,/${1:4PCO}//A/U`3/N3,/${1:4PCO}//B/G`8/O6;") 96 | cmd.do("distance hbond4,/${1:4PCO}//A/U`3/O2,/${1:4PCO}//B/G`8/N1;") 97 | cmd.do("color black, hbond1;") 98 | cmd.do("color black, hbond2;") 99 | cmd.do("color gray70, hbond3;") 100 | cmd.do("color gray70, hbond4;") 101 | cmd.do("show nb_spheres;") 102 | cmd.do("set nb_spheres_size, 0.35;") 103 | cmd.do("hide labels;") 104 | cmd.do("ray 1600,1000;") 105 | cmd.do("png ${1:4PCO}.png") 106 | $0 107 | 108 | snippet bu 109 | abbr bu 110 | alias bu 111 | cmd.do("run ~/${1:Scripts/PyMOLScripts}/quat.py;") 112 | cmd.do("quat;") 113 | $0 114 | 115 | snippet doubleBond 116 | abbr doubleBond 117 | alias doubleBond 118 | cmd.do("set valence, 1; ") 119 | cmd.do("set valence_mode, 1;") 120 | $0 121 | 122 | snippet cblind 123 | abbr cblind 124 | alias cblind 125 | cmd.do("run ~/${1:Pymol-script-repo}/colorblindfriendly.py;") 126 | cmd.do("as cartoon;") 127 | cmd.do("color cb_red, ss H;") 128 | cmd.do("color cb_yellow,ss S;") 129 | cmd.do("color cb_green, ss L+;") 130 | $0 131 | 132 | snippet centerpi 133 | abbr centerpi 134 | alias centerpi 135 | cmd.do("pseudoatom pi_cent,/${1:3nd3}/${2:A}/${3:U`15}/cg+cz;") 136 | cmd.do("dist pi_cent////ps1, b/${4:U`15}/${5:aaa};") 137 | $0 138 | 139 | snippet cribbon 140 | abbr cribbon 141 | alias cribbon 142 | cmd.do("as cartoon;") 143 | cmd.do("color red, ss H;") 144 | cmd.do("color yellow,ss S;") 145 | cmd.do("color green, ss L+;") 146 | $0 147 | 148 | snippet cspheres 149 | abbr cspheres 150 | alias cspheres 151 | cmd.do("as spheres;") 152 | cmd.do("color gray30, chain ${1:A};") 153 | cmd.do("color white, chain ${2:B};") 154 | cmd.do("color green, name CL;") 155 | cmd.do("color brown, resn NAG;") 156 | cmd.do("color red, resi 381;") 157 | cmd.do("remove solvent;") 158 | cmd.do("set specular, 0;") 159 | cmd.do("set ray_trace_gain, 0;") 160 | cmd.do("set ray_trace_mode, 3;") 161 | cmd.do("bg_color white;") 162 | cmd.do("set ray_trace_color, black;") 163 | cmd.do("set depth_cue,0;") 164 | $0 165 | 166 | snippet coordinate 167 | abbr coordinate 168 | alias coordinate 169 | cmd.do("viewport 900,600;") 170 | cmd.do("fetch 3nd4, type=pdb, async=0;") 171 | cmd.do("run ~/Scripts/PyMOLScripts/quat.py;") 172 | cmd.do("quat 3nd4;") 173 | cmd.do("show sticks;") 174 | cmd.do("set stick_radius=0.125;") 175 | cmd.do("hide everything, name H*;") 176 | cmd.do("bg_color white;") 177 | 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)));") 178 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/A`3/N7);") 179 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`119/O);") 180 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`219/O);") 181 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`319/O);") 182 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`519/O);") 183 | cmd.do("distance (3nd4_1 and chain Aand resi 19 and name NA), (3nd4_1 and chain A and resi 519);") 184 | cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 419);") 185 | cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 319);") 186 | cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 219);") 187 | cmd.do("show nb_spheres; ") 188 | cmd.do("set nb_spheres_size, .35;") 189 | cmd.do("distance hbond1,/3nd4_1/1/A/HOH`119/O, /3nd4_1/1/A/A`3/OP2;") 190 | cmd.do("distance hbond2,/3nd4_1/1/A/HOH`319/O, /3nd4_1/1/A/A`3/OP2;") 191 | cmd.do("distance hbond3,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/HOH`119/O;") 192 | cmd.do("distance hbond4,/3nd4_1/1/A/G`4/N7,/3nd4_1/1/A/HOH`91/O;") 193 | cmd.do("distance hbond5,/3nd4_1/1/A/G`4/O6, /3nd4_1/1/A/HOH`419/O;") 194 | cmd.do("distance hbond6,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/G`4/OP2;") 195 | cmd.do("distance hbond7,/3nd4_1/1/A/HOH`319/O,/3nd4_1/1/A/G`2/OP2;") 196 | cmd.do("distance hbond9,/3nd4_1/1/A/HOH`419/O,/3nd4_2/2/A/HOH`74/O;") 197 | cmd.do("distance hbond10,/3nd4_2/2/A/C`15/O2,/3nd4_1/1/A/G`2/N2;") 198 | cmd.do("distance hbond11, /3nd4_2/2/A/C`15/N3,/3nd4_1/1/A/G`2/N1;") 199 | cmd.do("distance hbond12,/3nd4_2/2/A/C`15/N4,/3nd4_1/1/A/G`2/O6;") 200 | cmd.do("distance hbond13, /3nd4_2/2/A/U`14/N3,/3nd4_1/1/A/A`3/N1;") 201 | cmd.do("distance hbond14,3nd4_2/2/A/U`14/O4,/3nd4_1/1/A/A`3/N6;") 202 | cmd.do("distance hbond15, /3nd4_2/2/A/C`13/N4,/3nd4_1/1/A/G`4/O6;") 203 | cmd.do(" distance hbond16,/3nd4_2/2/A/C`13/N3, /3nd4_1/1/A/G`4/N1;") 204 | cmd.do("distance hbond17, /3nd4_1/1/A/G`4/N2,/3nd4_2/2/A/C`13/O2;") 205 | cmd.do("distance hbond18,/3nd4_1/1/A/G`2/N2,/3nd4_2/2/A/C`15/O2;") 206 | cmd.do("distance hbond19,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/G`4/OP2; ") 207 | cmd.do("set depth_cue=0;") 208 | cmd.do("set ray_trace_fog=0;") 209 | cmd.do("set dash_color, black;") 210 | cmd.do("set label_font_id, 5;") 211 | cmd.do("set label_size, 36;") 212 | cmd.do("set label_position, (0.5, 1.0, 2.0);") 213 | cmd.do("set label_color, black;") 214 | cmd.do("set dash_gap, 0.2;") 215 | cmd.do("set dash_width, 2.0;") 216 | cmd.do("set dash_length, 0.2;") 217 | cmd.do("set label_color, black;") 218 | cmd.do("set dash_gap, 0.2;") 219 | cmd.do("set dash_width, 2.0;") 220 | cmd.do("set dash_length, 0.2;") 221 | cmd.do("select carbon, element C;") 222 | cmd.do("color yellow, carbon;") 223 | cmd.do("disable carbon;") 224 | 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)") 225 | $0 226 | 227 | snippet distance 228 | abbr distance 229 | alias distance 230 | cmd.do("# Edit the name for the ditance, the selection criteria for atom 1, and the selection criteria for atom 2.;") 231 | cmd.do("distance ${1:dist3}, ${2:/rcsb074137//B/IOD`605/I`B}, ${3:/rcsb074137//B/IOD`605/I`A};") 232 | $0 233 | 234 | snippet drawHbonds 235 | abbr drawHbonds 236 | alias drawHbonds 237 | cmd.do("hide everything, hydrogens;") 238 | cmd.do("hide labels;") 239 | cmd.do("# set the color of the dashed lines representing the H-bond.;") 240 | cmd.do("set dash_color, ${1:black};") 241 | cmd.do("set dash_gap, 0.4;") 242 | cmd.do("set dash_radius, 0.08;") 243 | $0 244 | 245 | snippet carvedIsomesh 246 | abbr carvedIsomesh 247 | alias carvedIsomesh 248 | cmd.do("delete all;") 249 | cmd.do("# Fetch the coordinates. Need internet connection.") 250 | cmd.do("fetch ${1:4dgr}, async=0;") 251 | cmd.do("# Fetch the electron density map.") 252 | cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;") 253 | cmd.do("# create a selection out of the glycan") 254 | cmd.do("select ${2:LongGlycan}, resi ${3:469:477};") 255 | cmd.do("orient ${2:LongGlycan};") 256 | cmd.do("remove not ${2:LongGlycan};") 257 | cmd.do("remove name H*;") 258 | cmd.do("isomesh 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 259 | cmd.do("color density, 2fofcmap; ") 260 | cmd.do("show sticks;") 261 | cmd.do("show spheres;") 262 | cmd.do("set stick_radius, .07;") 263 | cmd.do("set sphere_scale, .19;") 264 | cmd.do("set sphere_scale, .13, elem H;") 265 | cmd.do("set bg_rgb=[1, 1, 1];") 266 | cmd.do("set stick_quality, 50;") 267 | cmd.do("set sphere_quality, 4;") 268 | cmd.do("color gray85, elem C;") 269 | cmd.do("color red, elem O;") 270 | cmd.do("color slate, elem N;") 271 | cmd.do("color gray98, elem H;") 272 | cmd.do("set stick_color, gray50;") 273 | cmd.do("set ray_trace_mode, 1;") 274 | cmd.do("set ray_texture, 2;") 275 | cmd.do("set antialias, 3;") 276 | cmd.do("set ambient, 0.5;") 277 | cmd.do("set spec_count, 5;") 278 | cmd.do("set shininess, 50;") 279 | cmd.do("set specular, 1;") 280 | cmd.do("set reflect, .1;") 281 | cmd.do("set dash_gap, 0;") 282 | cmd.do("set dash_color, black;") 283 | cmd.do("set dash_gap, .15;") 284 | cmd.do("set dash_length, .05;") 285 | cmd.do("set dash_round_ends, 0;") 286 | cmd.do("set dash_radius, .05;") 287 | 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);") 288 | cmd.do("preset.ball_and_stick(\"all\",mode=1);") 289 | cmd.do("draw;") 290 | $0 291 | 292 | snippet fetch2FoFcIsomesh 293 | abbr fetch2FoFcIsomesh 294 | alias fetch2FoFcIsomesh 295 | cmd.do("fetch ${1:3nd4}, ${1:3nd4}_2fofc, type=2fofc, async=0;") 296 | cmd.do("isomesh 2fofcmap, ${1:3nd4}_2fofc, 1, ${1:3nd4}, carve = 1.8;") 297 | $0 298 | 299 | snippet fetchCIF 300 | abbr fetchCIF 301 | alias fetchCIF 302 | cmd.do("fetch ${1:3nd4}, type=cif, async=0;") 303 | $0 304 | 305 | snippet fetchFoFc 306 | abbr fetchFoFc 307 | alias fetchFoFc 308 | cmd.do("fetch ${1:3nd4}, ${1:3nd4}_fofc, type=fofc, async=0;") 309 | $0 310 | 311 | snippet filledRing 312 | abbr filledRing 313 | alias filledRing 314 | cmd.do("show sticks;set cartoon_ring_mode, 3;") 315 | cmd.do("set cartoon_ring_finder, 1;") 316 | cmd.do("set cartoon_ladder_mode, 1;") 317 | cmd.do("set cartoon_nucleic_acid_mode, 4;") 318 | cmd.do("set cartoon_ring_transparency, 0.5;") 319 | cmd.do("as cartoon;") 320 | $0 321 | 322 | snippet hbonddash 323 | abbr hbonddash 324 | alias hbonddash 325 | cmd.do("hide everything, hydrogens;") 326 | cmd.do("hide labels;") 327 | cmd.do("set dash_color, black; ") 328 | cmd.do("set dash_gap, 0.4;") 329 | cmd.do("set dash_radius, 0.08;") 330 | $0 331 | 332 | snippet hidealtloc 333 | abbr hidealtloc 334 | alias hidealtloc 335 | cmd.do("select altconf, alt ${1:b} # select B alternative locators;") 336 | cmd.do("hide everything, altconf # hide alt B locators;") 337 | $0 338 | 339 | snippet labelResnResi 340 | abbr labelResnResi 341 | alias labelResnResi 342 | cmd.do("label name ca, \"%s%s\" %(one_letter[${1:resn}],${2:resi});") 343 | $0 344 | 345 | snippet labelSS 346 | abbr labelSS 347 | alias labelSS 348 | cmd.do("alter ${1:chain A}, ss=\"${2:helix}\";") 349 | cmd.do("label (%2),\"%3\";") 350 | $0 351 | 352 | snippet loadPDBbs 353 | abbr loadPDBbs 354 | alias loadPDBbs 355 | cmd.do("fetch ${1:3nd3},name=${1:3nd3}, type=pdb, async=0;") 356 | cmd.do("hide (name H*);") 357 | cmd.do("hide lines;") 358 | cmd.do("show sticks;") 359 | cmd.do("set stick_radius, ${2:1.2};") 360 | cmd.do("set nb_sphere_radius, ${3:0.35};") 361 | cmd.do("orient;") 362 | $0 363 | 364 | snippet loadPDBnb 365 | abbr loadPDBnb 366 | alias loadPDBnb 367 | cmd.do("fetch ${1:3nd3}, name=${1:3nd3}, type=pdb, async=0;") 368 | cmd.do("orient;") 369 | cmd.do("set stick_radius, ${2:1.2};") 370 | cmd.do("hide (name H*);") 371 | cmd.do("set nb_sphere_size, ${3:0.35};") 372 | cmd.do("set nb_spheres_quality, ${4:1};") 373 | cmd.do("show nb_spheres;") 374 | $0 375 | 376 | snippet ms 377 | abbr ms 378 | alias ms 379 | cmd.do("fetch ${1:3nd3}, name=${1:3nd3}, type=pdb, async=0;") 380 | cmd.do("select ${2:temp}, ${1:3nd3} and chain ${4:A};") 381 | cmd.do("run ${5:/Users/blaine-mooers/Scripts/PyMOLScripts/msms_pymol.py};") 382 | cmd.do("calc_msms_area ${2:temp};") 383 | $0 384 | 385 | snippet molscriptRibbon 386 | abbr molscriptRibbon 387 | alias molscriptRibbon 388 | cmd.do("set cartoon_highlight_color, grey;") 389 | cmd.do("show cartoon;") 390 | cmd.do("set cartoon_flat_sheets, 0;") 391 | cmd.do("set cartoon_smooth_loops, 0;") 392 | cmd.do("set cartoon_fancy_helices, 1;") 393 | $0 394 | 395 | snippet oneLetter 396 | abbr oneLetter 397 | alias oneLetter 398 | 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\"}%") 399 | $0 400 | 401 | snippet pseudolabel 402 | abbr pseudolabel 403 | alias pseudolabel 404 | cmd.do("pseudoatom ${1:forLabel};") 405 | cmd.do("label ${1:forLabel}, \"%0\";") 406 | cmd.do("set label_color, ${2:red};") 407 | $0 408 | 409 | snippet rotate 410 | abbr rotate 411 | alias rotate 412 | cmd.do("rotate ${1:x}, ${2:45}, ${3:pept};") 413 | $0 414 | 415 | snippet stereoDraw 416 | abbr stereoDraw 417 | alias stereoDraw 418 | cmd.do("stereo walleye; ") 419 | cmd.do("set ray_shadow, off; ") 420 | cmd.do("#draw 3200,2000;") 421 | cmd.do("draw ${1:1600,1000}; ") 422 | cmd.do("png ${2:aaa}.png;") 423 | $0 424 | 425 | snippet stereoRay 426 | abbr stereoRay 427 | alias stereoRay 428 | cmd.do("stereo; ") 429 | cmd.do("set ray_shadow, off;") 430 | cmd.do("ray ${1:2400,1200};") 431 | cmd.do("png ${2:aaa}.png;") 432 | $0 433 | 434 | snippet loadThreeMaps 435 | abbr loadThreeMaps 436 | alias loadThreeMaps 437 | cmd.do("load ${1:4dgr}.pdb;") 438 | cmd.do("# Make sure to rename map file so that;") 439 | cmd.do("# the root filename differs from pdb root filename;") 440 | cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;") 441 | cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;") 442 | cmd.do("select ${2:glycan}, resid 200 or (resid 469:477);") 443 | cmd.do("isomesh ${3:mesh1}, 2fofc, 1.0, ${2:glycan};") 444 | cmd.do("color density, ${3:mesh1};") 445 | cmd.do("isomesh ${4:mesh2}, fofc, 3.0, ${2:glycan};") 446 | cmd.do("color green, ${4:mesh2};") 447 | cmd.do("isomesh ${5:mesh3}, fofc, -3.0, ${2:glycan};") 448 | cmd.do("color red, ${5:mesh3};") 449 | $0 450 | 451 | snippet turnAboutAxis 452 | abbr turnAboutAxis 453 | alias turnAboutAxis 454 | cmd.do("turn ${1:x},${2:90};") 455 | $0 456 | 457 | snippet volumeRamp 458 | abbr volumeRamp 459 | alias volumeRamp 460 | 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 461 | $0 462 | 463 | snippet solventRadius 464 | abbr solventRadius 465 | alias solventRadius 466 | cmd.do("set solvent_radius, ${1:1.55};") 467 | $0 468 | 469 | snippet rv 470 | abbr rv 471 | alias rv 472 | cmd.do("run roundview.py;") 473 | $0 474 | 475 | snippet spse 476 | abbr spse 477 | alias spse 478 | cmd.do("python;") 479 | cmd.do("import datetime;") 480 | cmd.do("from pymol import cmd; ") 481 | cmd.do("DT =datetime.datetime.now().strftime(\"yr%Ymo%mday%dhr%Hmin%M\");") 482 | cmd.do("s = str(DT); ") 483 | cmd.do("cmd.save(stemName+s+\".pse\"); ") 484 | cmd.do("python end;") 485 | $0 486 | 487 | snippet sc222 488 | abbr sc222 489 | alias sc222 490 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 491 | cmd.do("supercell 2, 2, 2, , ${2:orange}, ${3:supercell1}, 1;") 492 | $0 493 | 494 | snippet pearl 495 | abbr pearl 496 | alias pearl 497 | cmd.do("create ${1:sodium2}, ${2:sodium1};") 498 | cmd.do("set sphere_transparency, 0.4, ${1:sodium2};") 499 | cmd.do("set sphere_scale, 1.05, ${1:sodium2};") 500 | cmd.do("ray;") 501 | $0 502 | 503 | snippet fog 504 | abbr fog 505 | alias fog 506 | cmd.do("set fog, 0;") 507 | $0 508 | 509 | snippet rmwater 510 | abbr rmwater 511 | alias rmwater 512 | cmd.do("remove resn HOH;") 513 | $0 514 | 515 | snippet setcolor 516 | abbr setcolor 517 | alias setcolor 518 | cmd.do("set_color ${1:bark}, [${2:0.1, ${3:0.1}, ${4:0.1}];") 519 | cmd.do("color ${1:bark}, ${5:protein};") 520 | $0 521 | 522 | snippet duplicateObject 523 | abbr duplicateObject 524 | alias duplicateObject 525 | cmd.do("create ${1:t4l}, ${2:1lw9};") 526 | $0 527 | 528 | snippet selectChain 529 | abbr selectChain 530 | alias selectChain 531 | cmd.do("select ${1:rna}, ${2:chain B};") 532 | $0 533 | 534 | snippet selectResidues 535 | abbr selectResidues 536 | alias selectResidues 537 | cmd.do("select aromatic, resn phe+tyr+trp;") 538 | $0 539 | 540 | snippet selectResi 541 | abbr selectResi 542 | alias selectResi 543 | cmd.do("select ${!:se}; resi ${2: 1:100};") 544 | $0 545 | 546 | snippet selectElement 547 | abbr selectElement 548 | alias selectElement 549 | cmd.do("select ${1:oxygen}, elem ${2:O};") 550 | $0 551 | 552 | snippet selectName 553 | abbr selectName 554 | alias selectName 555 | cmd.do("select ${1:oxygen2}, name ${2:O2};") 556 | $0 557 | 558 | snippet selectHelices 559 | abbr selectHelices 560 | alias selectHelices 561 | cmd.do("select ${1:helices}, ss h; ") 562 | $0 563 | 564 | snippet selectStrands 565 | abbr selectStrands 566 | alias selectStrands 567 | cmd.do("select ${1:strands}, ss s; ") 568 | $0 569 | 570 | snippet selectLoops 571 | abbr selectLoops 572 | alias selectLoops 573 | cmd.do("select ${1:loops}, ss l;") 574 | $0 575 | 576 | snippet selectAllBut 577 | abbr selectAllBut 578 | alias selectAllBut 579 | cmd.do("select ${1:select1}, elem ${2:N} and chain ${3:A} and not resn ${4:LYS};") 580 | $0 581 | 582 | snippet selectAtomsAround 583 | abbr selectAtomsAround 584 | alias selectAtomsAround 585 | cmd.do("select ${1:nearby}, resn ${2:drug} around ${3:5};") 586 | $0 587 | 588 | snippet selectResiduesAround 589 | abbr selectResiduesAround 590 | alias selectResiduesAround 591 | cmd.do("select ${1:nearby}, br. resn ${2:drug} around ${3:5};") 592 | $0 593 | 594 | snippet undoSelection 595 | abbr undoSelection 596 | alias undoSelection 597 | cmd.do("disable ${1:sele}; ") 598 | $0 599 | 600 | snippet loadPDBfile 601 | abbr loadPDBfile 602 | alias loadPDBfile 603 | cmd.do("load ${1:my}.pdb;") 604 | $0 605 | 606 | snippet savePNG 607 | abbr savePNG 608 | alias savePNG 609 | cmd.do("png ${1:saveMe}.png, ${2:1920}, ${3:1920}, ${4:600}, ${5:1};") 610 | $0 611 | 612 | snippet ringMode 613 | abbr ringMode 614 | alias ringMode 615 | cmd.do("show cartoon, ${1:rna}; set cartoon_ring_mode, ${2:3};") 616 | $0 617 | 618 | snippet sidehChainHelper 619 | abbr sidehChainHelper 620 | alias sidehChainHelper 621 | cmd.do("set cartoon_side_chain_helper, on;") 622 | $0 623 | 624 | snippet extractPartObj 625 | abbr extractPartObj 626 | alias extractPartObj 627 | cmd.do("extract new_obj, chain A;") 628 | $0 629 | 630 | snippet puttyCartoon 631 | abbr puttyCartoon 632 | alias puttyCartoon 633 | cmd.do("show cartoon;") 634 | cmd.do("cartoon putty;") 635 | cmd.do("set cartoon_smooth_loops, 0;") 636 | cmd.do("set cartoon_flat_sheets, 0;") 637 | cmd.do("set cartoon_smooth_loops,0;") 638 | cmd.do("## unset cartoon_smooth_loops;") 639 | $0 640 | 641 | snippet hideSelection 642 | abbr hideSelection 643 | alias hideSelection 644 | cmd.do("indicate none") 645 | $0 646 | 647 | snippet discreteCartoonColoring 648 | abbr discreteCartoonColoring 649 | alias discreteCartoonColoring 650 | cmd.do("set cartoon_discrete_colors, on;") 651 | $0 652 | 653 | snippet sc111 654 | abbr sc111 655 | alias sc111 656 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 657 | cmd.do("supercell 1, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 658 | $0 659 | 660 | snippet saxsEnvelope 661 | abbr saxsEnvelope 662 | alias saxsEnvelope 663 | cmd.do("alter ${1:refine_A_Ave_SM_015_0_370-374-0r}, vdw=3.0;") 664 | cmd.do("set solvent_radius = 3.0;") 665 | $0 666 | 667 | snippet setpath 668 | abbr setpath 669 | alias setpath 670 | os.environ["PATH"] += os.pathsep +${1: "~/ATSAS-3.0.3-1/bin"}; $0 671 | $0 672 | 673 | snippet fetchPath 674 | abbr fetchPath 675 | alias fetchPath 676 | cmd.do("set fetch_path, ${1:/Users/blaine/pdbFiles};") 677 | $0 678 | 679 | snippet antialias 680 | abbr antialias 681 | alias antialias 682 | cmd.do("set antialias, 1;") 683 | $0 684 | 685 | snippet sigDigits 686 | abbr sigDigits 687 | alias sigDigits 688 | cmd.do("set label_distance_digits, ${1:2};") 689 | cmd.do("set label_angle_digits, ${2:2};") 690 | $0 691 | 692 | snippet labelCAs 693 | abbr labelCAs 694 | alias labelCAs 695 | cmd.do("label name CA,\"%s%s\" % (resn,resi);") 696 | $0 697 | 698 | snippet labelWatersHOH 699 | abbr labelWatersHOH 700 | alias labelWatersHOH 701 | cmd.do("label resn HOH ,\"%s%s\" % (resn,resi);") 702 | $0 703 | 704 | snippet labelWatersW 705 | abbr labelWatersW 706 | alias labelWatersW 707 | cmd.do("label resn HOH ,\"W%s\" % (resi);") 708 | $0 709 | 710 | snippet findHbonds 711 | abbr findHbonds 712 | alias findHbonds 713 | cmd.do("remove element h; distance hbonds, all, all, 3.2, mode=2;") 714 | $0 715 | 716 | snippet printBs 717 | abbr printBs 718 | alias printBs 719 | cmd.do("remove element h; iterate resi ${1: 1:13}, print(resi, name,b);") 720 | $0 721 | 722 | snippet labelMainChain 723 | abbr labelMainChain 724 | alias labelMainChain 725 | cmd.do("label name n+c+o+ca,\"%s%s%s\" % (resn,resi,name);") 726 | $0 727 | 728 | snippet printBspartB 729 | abbr printBspartB 730 | alias printBspartB 731 | cmd.do("iterate resi ${1:38} and altloc ${2:B}, print resi, name, alt, b;") 732 | $0 733 | 734 | snippet printBs2digits 735 | abbr printBs2digits 736 | alias printBs2digits 737 | cmd.do("iterate (resi ${1:133}), print(name + \" %.2f\" % b);") 738 | $0 739 | 740 | snippet writeCommandReference2HTML 741 | abbr writeCommandReference2HTML 742 | alias writeCommandReference2HTML 743 | cmd.write_html_ref("pymol-command-ref.html"); $0 744 | $0 745 | 746 | snippet averageB 747 | abbr averageB 748 | alias averageB 749 | cmd.do("Bfactors = []; ") 750 | cmd.do("# >>> edit the selection below, which is a range of residue numbers here.;") 751 | cmd.do("iterate (resi ${1:133}), Bfactors.append(b);") 752 | cmd.do("print(\"Sum = \", \"%.2f\" % (sum(Bfactors)));") 753 | cmd.do("print(\"Number of atoms = \", len(Bfactors));") 754 | cmd.do("print( \"Average B =\" , \"%.2f\" % ( sum(Bfactors)/float(len(Bfactors))));") 755 | $0 756 | 757 | snippet printNameB4ResiX 758 | abbr printNameB4ResiX 759 | alias printNameB4ResiX 760 | Bfac_dict = { "Bfactors3" : [] }; 761 | cmd.iterate("(${1:resi 133})","Bfactors3.append((name, b))", space=Bfac_dict); 762 | [print("%s %.2f" % (i,j)) for i,j in Bfac_dict["Bfactors3"]; $0 763 | $0 764 | 765 | snippet printResiResnNameB4ResiX 766 | abbr printResiResnNameB4ResiX 767 | alias printResiResnNameB4ResiX 768 | Bfac_dict = { "Bfactors3" : [] }; 769 | cmd.iterate("(${1:resi 133})","Bfactors3.append((resn,resi,name, b))", space=Bfac_dict); 770 | [print("%s %s %s %.2f" % (i,j,k,l)) for i,j,k,l in Bfac_dict["Bfactors3"]] $0 771 | $0 772 | 773 | snippet printResiResnNameB4ResiXNoH 774 | abbr printResiResnNameB4ResiXNoH 775 | alias printResiResnNameB4ResiXNoH 776 | Bfac_dict = { "Bfactors3" : [] }; 777 | cmd.iterate("(${1:resi 133} and not elem H)","Bfactors3.append((resn,resi,name, b))", space=Bfac_dict); 778 | [print("%s %s %s %.2f" % (i,j,k,l))for i,j,k,l in Bfac_dict["Bfactors3"]]; $0 779 | $0 780 | 781 | snippet internalGUImode2 782 | abbr internalGUImode2 783 | alias internalGUImode2 784 | cmd.do("internal_gui_mode=2;") 785 | $0 786 | 787 | snippet internalGUIwidth 788 | abbr internalGUIwidth 789 | alias internalGUIwidth 790 | cmd.do("set internal_gui_width=${1:0};") 791 | $0 792 | 793 | snippet printDoc 794 | abbr printDoc 795 | alias printDoc 796 | print(${1:my_func}.__doc__); $0 797 | $0 798 | 799 | snippet his31asp70 800 | abbr his31asp70 801 | alias his31asp70 802 | cmd.do("fetch ${1:1lw9}, async=0; ") 803 | cmd.do("zoom (${2:resi 31 or resi 70}); ") 804 | cmd.do("preset.technical(selection=\"all\"); ") 805 | cmd.do("bg_color ${3:gray70}; ") 806 | cmd.do("clip slab, 7,(${4:resi 31 or resi 70});") 807 | cmd.do("rock;") 808 | $0 809 | 810 | snippet waterTriple 811 | abbr waterTriple 812 | alias waterTriple 813 | cmd.do("fetch ${1:lw9}, async=0; ") 814 | cmd.do("zoom resi ${2:313}; ") 815 | cmd.do("preset.technical(selection=\"all\", mode=1);") 816 | $0 817 | 818 | snippet ligandSelect 819 | abbr ligandSelect 820 | alias ligandSelect 821 | cmd.do("select ${1:ligand}, organic;") 822 | $0 823 | 824 | snippet github 825 | abbr github 826 | alias github 827 | cmd.do("https://github.com/MooersLab/pymolsnips/blob/master/README.md") 828 | $0 829 | 830 | snippet sigdihedral 831 | abbr sigdihedral 832 | alias sigdihedral 833 | cmd.do("set label_dihedral_digits, ${1:2};") 834 | $0 835 | 836 | snippet stateOne 837 | abbr stateOne 838 | alias stateOne 839 | cmd.create("newobject", "oldobject", "1", "1"); $0 840 | $0 841 | 842 | snippet sc112 843 | abbr sc112 844 | alias sc112 845 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 846 | cmd.do("supercell 1, 1, 2, , ${2:orange}, ${3:supercell1}, 1;") 847 | $0 848 | 849 | snippet sc113 850 | abbr sc113 851 | alias sc113 852 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 853 | cmd.do("supercell 1, 1, 3, , ${2:orange}, ${3:supercell1}, 1;") 854 | $0 855 | 856 | snippet sc311 857 | abbr sc311 858 | alias sc311 859 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 860 | cmd.do("supercell 3, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 861 | $0 862 | 863 | snippet sc131 864 | abbr sc131 865 | alias sc131 866 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 867 | cmd.do("supercell 1, 3, 1, , ${2:orange}, ${3:supercell1}, 1;") 868 | $0 869 | 870 | snippet sc211 871 | abbr sc211 872 | alias sc211 873 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 874 | cmd.do("supercell 2, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 875 | $0 876 | 877 | snippet sc121 878 | abbr sc121 879 | alias sc121 880 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 881 | cmd.do("supercell 1, 2, 1, , ${2:orange}, ${3:supercell1}, 1;") 882 | $0 883 | 884 | snippet sc122 885 | abbr sc122 886 | alias sc122 887 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 888 | cmd.do("supercell 1, 2, 2, , ${2:orange}, ${3:supercell1}, 1;") 889 | $0 890 | 891 | snippet sc221 892 | abbr sc221 893 | alias sc221 894 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 895 | cmd.do("supercell 2, 2, 1, , ${2:orange}, ${3:supercell1}, 1;") 896 | $0 897 | 898 | snippet sc212 899 | abbr sc212 900 | alias sc212 901 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 902 | cmd.do("supercell 2, 1, 2, , ${2:orange}, ${3:supercell1}, 1;") 903 | $0 904 | 905 | snippet sc133 906 | abbr sc133 907 | alias sc133 908 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 909 | cmd.do("supercell 1, 3, 3, , ${2:orange}, ${3:supercell1}, 1;") 910 | $0 911 | 912 | snippet sc313 913 | abbr sc313 914 | alias sc313 915 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 916 | cmd.do("supercell 3, 1, 3, , ${2:orange}, ${3:supercell1}, 1;") 917 | $0 918 | 919 | snippet sc331 920 | abbr sc331 921 | alias sc331 922 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 923 | cmd.do("supercell 3, 3, 1, , ${2:orange}, ${3:supercell1}, 1;") 924 | $0 925 | 926 | snippet sc233 927 | abbr sc233 928 | alias sc233 929 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 930 | cmd.do("supercell 2, 3, 3, , ${2:orange}, ${3:supercell1}, 1;") 931 | $0 932 | 933 | snippet sc323 934 | abbr sc323 935 | alias sc323 936 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 937 | cmd.do("supercell 1, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 938 | $0 939 | 940 | snippet sc332 941 | abbr sc332 942 | alias sc332 943 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 944 | cmd.do("supercell 3, 3, 2, , ${2:orange}, ${3:supercell1}, 1;") 945 | $0 946 | 947 | snippet sc333 948 | abbr sc333 949 | alias sc333 950 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 951 | cmd.do("supercell 3, 3, 3, , ${2:orange}, ${3:supercell1}, 1;") 952 | $0 953 | 954 | snippet sc114 955 | abbr sc114 956 | alias sc114 957 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 958 | cmd.do("supercell 1, 1, 4, , ${2:orange}, ${3:supercell1}, 1;") 959 | $0 960 | 961 | snippet sc141 962 | abbr sc141 963 | alias sc141 964 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 965 | cmd.do("supercell 1, 4, 1, , ${2:orange}, ${3:supercell1}, 1;") 966 | $0 967 | 968 | snippet sc411 969 | abbr sc411 970 | alias sc411 971 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 972 | cmd.do("supercell 4, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 973 | $0 974 | 975 | snippet sccp4 976 | abbr sccp4 977 | alias sccp4 978 | cmd.do("python;") 979 | cmd.do("import datetime;") 980 | cmd.do("from pymol import cmd; ") 981 | cmd.do("DT =datetime.datetime.now().strftime(\"yr%Ymo%mday%dhr%Hmin%M\");") 982 | cmd.do("s = str(DT); ") 983 | cmd.do("cmd.save(stemName+s+\".ccp4\"); ") 984 | cmd.do("python end;") 985 | $0 986 | 987 | snippet sdae 988 | abbr sdae 989 | alias sdae 990 | import datetime; 991 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 992 | s = str(DT); 993 | cmd.save(stemName+s+".dae"); 994 | $0 995 | 996 | snippet carvedIsosurface 997 | abbr carvedIsosurface 998 | alias carvedIsosurface 999 | cmd.do("delete all;") 1000 | cmd.do("# Fetch the coordinates. Need internet connection.;") 1001 | cmd.do("fetch ${1:4dgr}, async=0;") 1002 | cmd.do("# Fetch the electron density map.;") 1003 | cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;") 1004 | cmd.do("# create a selection out of the glycan;") 1005 | cmd.do("select ${2:LongGlycan}, resi ${3:469:477};") 1006 | cmd.do("orient ${2:LongGlycan};") 1007 | cmd.do("remove not ${2:LongGlycan};") 1008 | cmd.do("remove name H*;") 1009 | cmd.do("isosurface 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 1010 | cmd.do("color density, 2fofcmap; ") 1011 | cmd.do("show sticks;") 1012 | cmd.do("show spheres;") 1013 | cmd.do("set stick_radius, .07;") 1014 | cmd.do("set sphere_scale, .19;") 1015 | cmd.do("set sphere_scale, .13, elem H;") 1016 | cmd.do("set bg_rgb=[1, 1, 1];") 1017 | cmd.do("set stick_quality, 50;") 1018 | cmd.do("set sphere_quality, 4;") 1019 | cmd.do("color gray85, elem C;") 1020 | cmd.do("color red, elem O;") 1021 | cmd.do("color slate, elem N;") 1022 | cmd.do("color gray98, elem H;") 1023 | cmd.do("set stick_color, gray50;") 1024 | cmd.do("set ray_trace_mode, 1;") 1025 | cmd.do("set ray_texture, 2;") 1026 | cmd.do("set antialias, 3;") 1027 | cmd.do("set ambient, 0.5;") 1028 | cmd.do("set spec_count, 5;") 1029 | cmd.do("set shininess, 50;") 1030 | cmd.do("set specular, 1;") 1031 | cmd.do("set reflect, .1;") 1032 | cmd.do("set dash_gap, 0;") 1033 | cmd.do("set dash_color, black;") 1034 | cmd.do("set dash_gap, .15;") 1035 | cmd.do("set dash_length, .05;") 1036 | cmd.do("set dash_round_ends, 0;") 1037 | cmd.do("set dash_radius, .05;") 1038 | 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);") 1039 | cmd.do("preset.ball_and_stick(\"all\",mode=1);") 1040 | cmd.do("draw;") 1041 | $0 1042 | 1043 | snippet fetch2FoFcIsosurface 1044 | abbr fetch2FoFcIsosurface 1045 | alias fetch2FoFcIsosurface 1046 | cmd.do("fetch ${1:3nd4}, ${1:3nd4}_2fofc, type=2fofc, async=0;") 1047 | cmd.do("isosurface 2fofcmap, ${1:3nd4}_2fofc, 1, ${1:3nd4}, carve = 1.8;") 1048 | $0 1049 | 1050 | snippet threeMapsIsosurface 1051 | abbr threeMapsIsosurface 1052 | alias threeMapsIsosurface 1053 | cmd.do("load ${1:4dgr}.pdb;") 1054 | cmd.do("# Make sure to rename map file so that ;") 1055 | cmd.do("# the root filename differs from pdb root filename;") 1056 | cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;") 1057 | cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;") 1058 | cmd.do("select ${2:glycan}, ${3:resid 200 or (resid 469:477)};") 1059 | cmd.do("isosurface ${4:mesh1}, 2fofc, 1.0, ${2:glycan};") 1060 | cmd.do("color density, ${4:mesh1};") 1061 | cmd.do("isosurface ${5:mesh2}, fofc, 3.0, ${2:glycan};") 1062 | cmd.do("color green, ${5:mesh2};") 1063 | cmd.do("isosurface ${6:mesh3}, fofc, -3.0, ${2:glycan};") 1064 | cmd.do("color red, ${6:mesh3};") 1065 | $0 1066 | 1067 | snippet carvedVolume 1068 | abbr carvedVolume 1069 | alias carvedVolume 1070 | cmd.do("delete all;") 1071 | cmd.do("# Fetch the coordinates. Need internet connection.;") 1072 | cmd.do("fetch ${1:4dgr}, async=0;") 1073 | cmd.do("# Fetch the electron density map.;") 1074 | cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;") 1075 | cmd.do("# create a selection out of the glycan;") 1076 | cmd.do("select ${2:LongGlycan}, resi ${3:469:477};") 1077 | cmd.do("# oreint the long axes of the object along the x-axis;") 1078 | cmd.do("orient ${2:LongGlycan};") 1079 | cmd.do("# remove everything except the glycan;") 1080 | cmd.do("remove not ${2:LongGlycan};") 1081 | cmd.do("# remove the remaining hydrogen atoms;") 1082 | cmd.do("remove name H*;") 1083 | cmd.do("# show the electron density map as a surface.") 1084 | cmd.do("surface 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 1085 | cmd.do("color density, 2fofcmap; ") 1086 | cmd.do("show sticks;") 1087 | cmd.do("show spheres;") 1088 | cmd.do("set stick_radius, .07;") 1089 | cmd.do("set sphere_scale, .19;") 1090 | cmd.do("set sphere_scale, .13, elem H;") 1091 | cmd.do("set bg_rgb=[1, 1, 1];") 1092 | cmd.do("set stick_quality, 50;") 1093 | cmd.do("# make the spheres smooth with larger settings.;") 1094 | cmd.do("set sphere_quality, 4;") 1095 | cmd.do("# gray85 is off-white, gray0 is black;") 1096 | cmd.do("color gray85, elem C;") 1097 | cmd.do("color red, elem O;") 1098 | cmd.do("color slate, elem N;") 1099 | cmd.do("color gray98, elem H;") 1100 | cmd.do("set stick_color, gray50;") 1101 | cmd.do("set ray_trace_mode, 1;") 1102 | cmd.do("set ray_texture, 2;") 1103 | cmd.do("set antialias, 3;") 1104 | cmd.do("set ambient, 0.5;") 1105 | cmd.do("set spec_count, 5;") 1106 | cmd.do("set shininess, 50;") 1107 | cmd.do("set specular, 1;") 1108 | cmd.do("set reflect, .1;") 1109 | cmd.do("set dash_gap, 0;") 1110 | cmd.do("set dash_color, black;") 1111 | cmd.do("set dash_gap, .15;") 1112 | cmd.do("set dash_length, .05;") 1113 | cmd.do("set dash_round_ends, 0;") 1114 | cmd.do("set dash_radius, .05;") 1115 | 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);") 1116 | cmd.do("preset.ball_and_stick(\"all\",mode=1);") 1117 | cmd.do("draw;") 1118 | $0 1119 | 1120 | snippet fetch2FoFcVolume 1121 | abbr fetch2FoFcVolume 1122 | alias fetch2FoFcVolume 1123 | cmd.do("fetch ${1:3nd4}, type=cif, async=0;") 1124 | cmd.do("fetch ${1:3nd4}, {1:3nd4}_2fofc, type=2fofc, async=0;") 1125 | cmd.do("# Render and display a contour of this map as a volume around a selection called LongGlycan.;") 1126 | cmd.do("volume 2fofcmap, ${1:3nd4}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 1127 | $0 1128 | 1129 | snippet threeMapsVolume 1130 | abbr threeMapsVolume 1131 | alias threeMapsVolume 1132 | cmd.do("load ${1:4dgr}.pdb;") 1133 | cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;") 1134 | cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;") 1135 | cmd.do("select ${2:glycan}, ${3:resid 200 or (resid 469:477)};") 1136 | cmd.do("volume ${4:mesh1}, 2fofc, 1.0, ${2:glycan};") 1137 | cmd.do("color density, ${4:mesh1};") 1138 | cmd.do("volume ${5:mesh2}, fofc, 3.0, ${2:glycan};") 1139 | cmd.do("color green, ${5:mesh2};") 1140 | cmd.do("volume ${6:mesh3}, fofc, -3.0, ${2:glycan};") 1141 | cmd.do("color red, ${6:mesh3};") 1142 | $0 1143 | 1144 | snippet rvi 1145 | abbr rvi 1146 | alias rvi 1147 | def rvj(StoredView=0, decimal_places=2, outname="roundedview.txt"): 1148 | """ 1149 | rvj() is a modification of the the rv() function (aka the roundview.py) 1150 | so that it can run in Jupyter notebooks with the ipymol.viewer. 1151 | A set_view string is printed to the noteobook in a format that is ready 1152 | for reuse. 1153 | 1154 | The ipymol module was developed by Carlos Hernandez: 1155 | 1156 | https://github.com/cxhernandez/ipymol 1157 | 1158 | The pre-requisites for installing ipymol are as follows: 1159 | 1160 | 1. Make a jupyter notebook kernel for Python interpreter inside of 1161 | the Schrodinger PyMOL. See the PyMOL Snippets GitHub Page for 1162 | a description of how to make one. 1163 | 2. Install the following build of ipymol at the PyMOL prompt. 1164 | You need to log into your GitHub account first. 1165 | 1166 | pip install git+pip install git+https://github.com/cxhernandez/ipymol.git@2a30d6ec1588434e6f0f72a1d572444f89ff535b 1167 | 1168 | 3. Make a bash alias to this PyMOL app file. 1169 | 1170 | 4. Launch the jupyter notebook and select the pymol.python kernel. 1171 | 1172 | 5. Open a terminal instance from the File pulldown in jupyter notebook. 1173 | 1174 | 6. Enter `pymol -Rq` to launch an interactive instance of PyMOL. 1175 | 1176 | 7. Enter the following code to load ipymol and conmect to PyMOL 1177 | 1178 | from ipymol import viewer as ipv 1179 | ipv.start() # Start PyMOL RPC server 1180 | 1181 | Now you can change the scene manually and send the display as static 1182 | image to a cell in the jupyter notebook. 1183 | 1184 | It is assumed that the viewer class of the ipymol moduel has been 1185 | imported as ipv. 1186 | 1187 | I made the following modifications of roundview.py. 1188 | The cmd.get_view was replaced with ipv.get_view. 1189 | The cmd.extend was replaced with ipv.extend. 1190 | The myRoundedList was returned for further processing. 1191 | 1192 | MIT License 1193 | 1194 | Copyright: 1195 | Blaine Mooers and the OU Board of Regents 1196 | University of Oklahoma Health Sciences Center 1197 | Oklahoma City, OK 73104 1198 | 1199 | 29 April 2020 1200 | 1201 | """ 1202 | 1203 | 1204 | StoredView = int(StoredView) 1205 | decimal_places = int(decimal_places) 1206 | 1207 | #call the get_view function 1208 | 1209 | m = ipv.get_view(StoredView) 1210 | 1211 | 1212 | #Make a list of the elements in the orientation matrix. 1213 | 1214 | myList = [m[0], m[1], m[2], m[3], m[4], m[5], m[6],m[7], m[8], m[9], 1215 | m[10], m[11], m[12], m[13], m[14],m[15], m[16], m[17]] 1216 | 1217 | #Round off the matrix elements to two decimal places (two fractional places) 1218 | #This rounding approach solved the problem of unwanted 1219 | #whitespaces when I tried to use a string format statement 1220 | 1221 | myRoundedList = [round(elem, decimal_places) for elem in myList] 1222 | 1223 | #x is the string template for the output. The whitespace is required 1224 | #between the "set_view" and "(" 1225 | 1226 | x = "set_view ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17});" 1227 | 1228 | # Print to the command history window. 1229 | print(x.format(*myRoundedList)) 1230 | 1231 | #Write to a text file. 1232 | myFile = open("roundedview.txt", "a") 1233 | myFile.write(x.format(*myRoundedList) + "") 1234 | myFile.close() 1235 | return myRoundedList $0 1236 | $0 1237 | 1238 | snippet rdkrpcChem 1239 | abbr rdkrpcChem 1240 | alias rdkrpcChem 1241 | import os; 1242 | import rdkit; 1243 | from rdkit import Chem; 1244 | from rdkit.Chem import AllChem; 1245 | from rdkit.Chem import PyMol; 1246 | 1247 | s = PyMOL.MolViewer(); 1248 | mol = Chem.MolFromSmiles("${1:CCOCCn1c(C2CC[NH+](CCc3ccc(C(C)(C)C(=O)[O-])cc3)CC2)nc2ccccc21}"); 1249 | mol = AllChem.AddHs(mol); 1250 | AllChem.EmbedMolecule(mol); 1251 | AllChem.MMFFOptimizeMolecule(mol); 1252 | s.ShowMol(mol, name = "${2:bilastine}", showOnly = False); 1253 | s.Zoom("${2:bilastine}"); 1254 | s.SetDisplayStyle("${2:bilastine}", "sticks"); 1255 | s.GetPNG(preDelay=5); $0 1256 | $0 1257 | 1258 | snippet kernel 1259 | abbr kernel 1260 | alias kernel 1261 | { 1262 | "argv": [ 1263 | "/Applications/PyMOL.app/Contents/bin/python", 1264 | "-m", 1265 | "ipykernel_launcher", 1266 | "-f", 1267 | "{connection_file}" 1268 | ], 1269 | "display_name": "pymol.python", 1270 | "language": "python" 1271 | } $0 1272 | $0 1273 | 1274 | snippet rdkrpcProtein 1275 | abbr rdkrpcProtein 1276 | alias rdkrpcProtein 1277 | from rdkit.Chem import PyMol; 1278 | 1279 | Usage=""""Start pymol from command line with -R flag. 1280 | Select the pymol.python kernel in Jupyter notebook. """; 1281 | 1282 | s = PyMol.MolViewer(); 1283 | du = s.server.do; 1284 | 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});"); 1285 | s.GetPNG(preDelay=3); 1286 | du("png ${3:T4L600dpi}.png, dpi=600"); $0 1287 | $0 1288 | 1289 | snippet ipymolStart 1290 | abbr ipymolStart 1291 | alias ipymolStart 1292 | from ipymol import viewer as ipv; 1293 | ipv.start() # Start PyMOL RPC server; $0 1294 | $0 1295 | 1296 | snippet ipymolProtein 1297 | abbr ipymolProtein 1298 | alias ipymolProtein 1299 | from ipymol import viewer as ipv; 1300 | # Start PyMOL RPC server; 1301 | ipv.start(); 1302 | ipv.do("fetch ${1:1lw9}"); 1303 | ipv.do("rv"); 1304 | 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)); 1305 | ipv.do("AOD"); 1306 | ipv.png("${2:testipymolT4L}.png"); $0 1307 | $0 1308 | 1309 | snippet rvr 1310 | abbr rvr 1311 | alias rvr 1312 | def rvr(StoredView=0, decimal_places=2, outname="roundedview.txt"): 1313 | """MIT License 1314 | Copyright: 1315 | Blaine Mooers and the OU Board of Regents 1316 | University of Oklahoma Health Sciences Center 1317 | Oklahoma City, OK 73104 1318 | 30 April 2020 1319 | 1320 | First run the following: 1321 | 1322 | from rdkit.Chem import PyMol 1323 | s = PyMol.MolViewer() 1324 | du = s.server.do 1325 | 1326 | """ 1327 | StoredView = int(StoredView) decimal_places = int(decimal_places) 1328 | #call the get_view function 1329 | m = s.get_view(StoredView) 1330 | #Make a list of the elements in the orientation matrix. 1331 | myList = [m[0], m[1], m[2], m[3], m[4], m[5], m[6],m[7], m[8], m[9], 1332 | m[10], m[11], m[12], m[13], m[14],m[15], m[16], m[17]] 1333 | #Round off the matrix elements to two decimal places (two fractional places) 1334 | #This rounding approach solved the problem of unwanted 1335 | #whitespaces when I tried to use a string format statement 1336 | myRoundedList = [round(elem, decimal_places) for elem in myList] 1337 | #x is the string template for the output. The whitespace is required 1338 | #between the "set_view" and "(" 1339 | x = "set_view ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17});" 1340 | # Print to the command history window. 1341 | print(x.format(*myRoundedList)) 1342 | #Write to a text file. 1343 | myFile = open("roundedview.txt", "a") myFile.write(x.format(*myRoundedList) + "") myFile.close() 1344 | return myRoundedList $0 1345 | $0 1346 | 1347 | snippet cmddocs 1348 | abbr cmddocs 1349 | alias cmddocs 1350 | [help(i) for i in dir(cmd)]; $0 1351 | $0 1352 | 1353 | snippet pymoldocs 1354 | abbr pymoldocs 1355 | alias pymoldocs 1356 | [help(i) for i in dir(pymol)]; $0 1357 | $0 1358 | 1359 | snippet numResiProtein 1360 | abbr numResiProtein 1361 | alias numResiProtein 1362 | sel = "polymer.protein"; print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom]))); $0 1363 | $0 1364 | 1365 | snippet numResiProteinChainA 1366 | abbr numResiProteinChainA 1367 | alias numResiProteinChainA 1368 | 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 1369 | $0 1370 | 1371 | snippet numResiNucleic 1372 | abbr numResiNucleic 1373 | alias numResiNucleic 1374 | sel = "polymer.nucleic"; 1375 | [print(len(set([(i.resi, i.resn) for i in cmd.get_model(sel).atom])))]; $0 1376 | $0 1377 | 1378 | snippet numResiNucleicChainA 1379 | abbr numResiNucleicChainA 1380 | alias numResiNucleicChainA 1381 | sel = "${1:chain A} and polymer.nucleic"; 1382 | [print(len(set([(i.resi, i.resn) for i in cmd.get_model(sel).atom])))]; $0 1383 | $0 1384 | 1385 | snippet brokenNucleicBackbone 1386 | abbr brokenNucleicBackbone 1387 | alias brokenNucleicBackbone 1388 | [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})]; 1389 | [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 1390 | $0 1391 | 1392 | snippet oneBondThicknessColor 1393 | abbr oneBondThicknessColor 1394 | alias oneBondThicknessColor 1395 | cmd.do("set_bond stick_color, ${1:yellow}, index 2, index 3;") 1396 | cmd.do("set_bond stick_radius, ${2:0.2}, index 2, index 3;") 1397 | $0 1398 | 1399 | snippet drawLinks 1400 | abbr drawLinks 1401 | alias drawLinks 1402 | 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};") 1403 | $0 1404 | 1405 | snippet printPath 1406 | abbr printPath 1407 | alias printPath 1408 | print(pymol.__path__) 1409 | $0 1410 | 1411 | snippet setLigandValenceOn 1412 | abbr setLigandValenceOn 1413 | alias setLigandValenceOn 1414 | cmd.do("set valence, on, resn ${1:RZS}; set valence, off, not resn ${2:RZS};") 1415 | $0 1416 | 1417 | snippet presetDocs 1418 | abbr presetDocs 1419 | alias presetDocs 1420 | help(preset) $0 1421 | $0 1422 | 1423 | snippet helpDocs 1424 | abbr helpDocs 1425 | alias helpDocs 1426 | cmd.do("help(help)") 1427 | $0 1428 | 1429 | snippet loadAmberTrajs 1430 | abbr loadAmberTrajs 1431 | alias loadAmberTrajs 1432 | cmd.do("load ${1:file}.top, ${2:protein};") 1433 | cmd.do("load ${1:file}.rst, ${2:protein};") 1434 | $0 1435 | 1436 | snippet saveSeppy 1437 | abbr saveSeppy 1438 | alias saveSeppy 1439 | from pymol import cmd 1440 | import glob 1441 | import re 1442 | 1443 | def saveSep(prefix=""): 1444 | """ 1445 | save_sep 1446 | 1447 | saves multiple objects into multiple files using an optional prefix name. 1448 | 1449 | e.g. save_sep prefix 1450 | """ 1451 | obj_list = cmd.get_names("all") 1452 | 1453 | if obj_list: 1454 | for i in range(len(obj_list)): 1455 | obj_name = "%s%s.pdb" % (prefix, obj_list[i]) 1456 | cmd.save(obj_name, obj_list[i]) 1457 | print("Saving %s" % obj_name) 1458 | else: 1459 | print("No objects found") $0 1460 | $0 1461 | 1462 | snippet optAlignRNA 1463 | abbr optAlignRNA 1464 | alias optAlignRNA 1465 | #!python 1466 | 1467 | ############################################################################## 1468 | # 1469 | # @SUMMARY: -- QKabsch.py. A python implementation of the optimal superposition 1470 | # of two sets of vectors as proposed by Kabsch 1976 & 1978. 1471 | # 1472 | # @AUTHOR: Jason Vertrees 1473 | # @COPYRIGHT: Jason Vertrees (C), 2005-2007 1474 | # @LICENSE: Released under GPL: 1475 | # This program is free software; you can redistribute it and/or modify 1476 | # it under the terms of the GNU General Public License as published by 1477 | # the Free Software Foundation; either version 2 of the License, or 1478 | # (at your option) any later version. 1479 | # This program is distributed in the hope that it will be useful, but WITHOUT 1480 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 1481 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 1482 | # 1483 | # You should have received a copy of the GNU General Public License along with 1484 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 1485 | # Street, Fifth Floor, Boston, MA 02110-1301, USA 1486 | # 1487 | # DATE : 2007-01-01 1488 | # REV : 2 1489 | # REQUIREMENTS: numpy 1490 | # 1491 | # 1492 | # Modified optAlign.py to use C1 prime carbon atoms of RNA for alignment. 1493 | # Jan. 29, 2020 1494 | # Blaine Mooers, PhD 1495 | # Univ. of Oklahoma Health Sciences Center 1496 | # 1497 | ############################################################################# 1498 | from array import * 1499 | 1500 | # system stuff 1501 | import os 1502 | import copy 1503 | 1504 | # pretty printing 1505 | import pprint 1506 | 1507 | # for importing as a plugin into PyMol 1508 | from pymol import cmd 1509 | from pymol import stored 1510 | from pymol import selector 1511 | 1512 | # using numpy for linear algebra 1513 | import numpy 1514 | 1515 | def optAlignRNA( sel1, sel2 ): 1516 | """ 1517 | optAlignRNA performs the Kabsch alignment algorithm upon the C1" carbons of two selections. 1518 | Example: optAlignRNA 1JU7 and i. 1-16 and n. C1", 1CLL and i. 4-146 and n. C1" 1519 | 1520 | Two RMSDs are returned. One comes from the Kabsch algorithm and the other from 1521 | PyMOL based upon your selections. 1522 | 1523 | This function can be run in a for loop to fit multiple structures with a common prefix name: 1524 | 1525 | for x in cmd.get_names(): optAlignRNA(x, "1JU7_0001") 1526 | 1527 | or get the rmsds for all combinations, do the following: 1528 | 1529 | [[optAlignRNA(x, y) for x in cmd.get_names()] for y in cmd.get_names()] 1530 | 1531 | """ 1532 | cmd.reset() 1533 | 1534 | # make the lists for holding coordinates 1535 | # partial lists 1536 | stored.sel1 = [] 1537 | stored.sel2 = [] 1538 | # full lists 1539 | stored.mol1 = [] 1540 | stored.mol2 = [] 1541 | 1542 | # -- CUT HERE 1543 | sel1 += " and N. C1"" 1544 | sel2 += " and N. C1"" 1545 | # -- CUT HERE 1546 | 1547 | # Get the selected coordinates. We 1548 | # align these coords. 1549 | cmd.iterate_state(1, selector.process(sel1), "stored.sel1.append([x,y,z])") 1550 | cmd.iterate_state(1, selector.process(sel2), "stored.sel2.append([x,y,z])") 1551 | 1552 | # get molecule name 1553 | mol1 = cmd.identify(sel1,1)[0][0] 1554 | mol2 = cmd.identify(sel2,1)[0][0] 1555 | 1556 | # Get all molecule coords. We do this because 1557 | # we have to rotate the whole molcule, not just 1558 | # the aligned selection 1559 | cmd.iterate_state(1, mol1, "stored.mol1.append([x,y,z])") 1560 | cmd.iterate_state(1, mol2, "stored.mol2.append([x,y,z])") 1561 | 1562 | # check for consistency 1563 | assert len(stored.sel1) == len(stored.sel2) 1564 | L = len(stored.sel1) 1565 | assert L > 0 1566 | 1567 | # must alway center the two proteins to avoid 1568 | # affine transformations. Center the two proteins 1569 | # to their selections. 1570 | COM1 = numpy.sum(stored.sel1,axis=0) / float(L) 1571 | COM2 = numpy.sum(stored.sel2,axis=0) / float(L) 1572 | stored.sel1 -= COM1 1573 | stored.sel2 -= COM2 1574 | 1575 | # Initial residual, see Kabsch. 1576 | E0 = numpy.sum( numpy.sum(stored.sel1 * stored.sel1,axis=0),axis=0) + numpy.sum( numpy.sum(stored.sel2 * stored.sel2,axis=0),axis=0) 1577 | 1578 | # 1579 | # This beautiful step provides the answer. V and Wt are the orthonormal 1580 | # bases that when multiplied by each other give us the rotation matrix, U. 1581 | # S, (Sigma, from SVD) provides us with the error! Isn"t SVD great! 1582 | V, S, Wt = numpy.linalg.svd( numpy.dot( numpy.transpose(stored.sel2), stored.sel1)) 1583 | 1584 | # we already have our solution, in the results from SVD. 1585 | # we just need to check for reflections and then produce 1586 | # the rotation. V and Wt are orthonormal, so their det"s 1587 | # are +/-1. 1588 | reflect = float(str(float(numpy.linalg.det(V) * numpy.linalg.det(Wt)))) 1589 | 1590 | if reflect == -1.0: 1591 | S[-1] = -S[-1] 1592 | V[:,-1] = -V[:,-1] 1593 | 1594 | RMSD = E0 - (2.0 * sum(S)) 1595 | RMSD = numpy.sqrt(abs(RMSD / L)) 1596 | 1597 | #U is simply V*Wt 1598 | U = numpy.dot(V, Wt) 1599 | 1600 | # rotate and translate the molecule 1601 | stored.sel2 = numpy.dot((stored.mol2 - COM2), U) 1602 | stored.sel2 = stored.sel2.tolist() 1603 | # center the molecule 1604 | stored.sel1 = stored.mol1 - COM1 1605 | stored.sel1 = stored.sel1.tolist() 1606 | 1607 | # let PyMol know about the changes to the coordinates 1608 | cmd.alter_state(1,mol1,"(x,y,z)=stored.sel1.pop(0)") 1609 | cmd.alter_state(1,mol2,"(x,y,z)=stored.sel2.pop(0)") 1610 | 1611 | #print("Moved: %s Reference: %s RMSD = %f" % mol1, mol2, RMSD) 1612 | print("% s, % s,% 5.3f" % (mol1, mol2, RMSD)) 1613 | 1614 | # make the alignment OBVIOUS 1615 | cmd.hide("everything") 1616 | cmd.show("ribbon", sel1 + " or " + sel2) 1617 | cmd.color("gray70", mol1 ) 1618 | cmd.color("magenta", mol2 ) 1619 | cmd.color("red", "visible") 1620 | cmd.show("ribbon", "not visible") 1621 | cmd.center("visible") 1622 | cmd.orient() 1623 | cmd.zoom("visible") $0 1624 | $0 1625 | 1626 | snippet loadManyFiles 1627 | abbr loadManyFiles 1628 | alias loadManyFiles 1629 | # Copyright (c) 2004 Robert L. Campbell 1630 | # 1631 | # Modified for use with Python3. 1632 | # Jan. 29, 2020 1633 | # Blaine Mooers, PhD 1634 | # Univ. of Oklahoma Health Sciences Center 1635 | # 1636 | # 1637 | from pymol import cmd 1638 | import glob 1639 | 1640 | def loadFiles(files): 1641 | """ 1642 | load_files 1643 | 1644 | loads multiple files (using filename globbing) 1645 | into a multiple objects named as the files are (e.g. collection of 1646 | downloaded PDB files). 1647 | 1648 | e.g. load_files prot_*.pdb 1649 | """ 1650 | file_list = glob.glob(files) 1651 | if file_list: 1652 | file_list.sort() 1653 | for i in file_list: 1654 | #obj_name = i.replace(".pdb","") 1655 | #cmd.load(file_list[i],obj_name) 1656 | cmd.load(i) 1657 | else: 1658 | print("No files found for pattern %s" % files) $0 1659 | $0 1660 | 1661 | snippet loadAndAlignManyFiles3 1662 | abbr loadAndAlignManyFiles3 1663 | alias loadAndAlignManyFiles3 1664 | from pymol import cmd 1665 | import glob 1666 | import re 1667 | 1668 | 1669 | def saveSep(prefix=""): 1670 | """ 1671 | Saves multiple objects into multiple files using an optional prefix name. 1672 | This function is can save time. 1673 | 1674 | Usage in PyMOL: 1675 | 1676 | saveSep 1677 | 1678 | Usage in pymol"s Python API: 1679 | 1680 | cmd.do("saveSep ") 1681 | 1682 | e.g. saveSep prefix 1683 | """ 1684 | obj_list = cmd.get_names("all") 1685 | 1686 | if obj_list: 1687 | for i in range(len(obj_list)): 1688 | obj_name = "%s%s.pdb" % (prefix, obj_list[i]) 1689 | cmd.save(obj_name, obj_list[i]) 1690 | print("Saving %s" % obj_name) 1691 | else: 1692 | print("No objects found") 1693 | 1694 | 1695 | cmd.extend("saveSep", saveSep) $0 1696 | $0 1697 | 1698 | snippet allPairs 1699 | abbr allPairs 1700 | alias allPairs 1701 | [[${1:optAlignRNA}(x, y) for x in cmd.get_names()] for y in cmd.get_names()]; $0 1702 | $0 1703 | 1704 | snippet dssrBlock1 1705 | abbr dssrBlock1 1706 | alias dssrBlock1 1707 | cmd.do("reinitialize;") 1708 | cmd.do("run /Users/blaine/.pymol/startup/dssr_block.py;") 1709 | cmd.do("fetch 1ehz, async=0;") 1710 | cmd.do("as cartoon;") 1711 | cmd.do("set cartoon_ladder_radius, 0.1;") 1712 | cmd.do("set cartoon_ladder_color, gray;") 1713 | cmd.do("set cartoon_nucleic_acid_mode, 1;") 1714 | cmd.do("set cartoon_nucleic_acid_color, orange;") 1715 | cmd.do("orient;turn z,30; translate [0,5,0]") 1716 | cmd.do("dssr_block;") 1717 | cmd.do("png ~/dssrBlock1.png 1600,1600") 1718 | $0 1719 | 1720 | snippet dssrBlock2 1721 | abbr dssrBlock2 1722 | alias dssrBlock2 1723 | cmd.do("reinitialize;") 1724 | cmd.do("run /Users/blaine/.pymol/startup/dssr_block.py;") 1725 | cmd.do("set cartoon_nucleic_acid_color, orange;") 1726 | cmd.do("fetch 1ehz, async=0;") 1727 | cmd.do("dssr_block block_file=wc") 1728 | $0 1729 | 1730 | snippet dssrBlock3 1731 | abbr dssrBlock3 1732 | alias dssrBlock3 1733 | cmd.do("reinitialize;") 1734 | cmd.do("run ${1:\"/Users/blaine/.pymol/startup/dssr_block.py\"};") 1735 | cmd.do("fetch ${2:2n2d}, async=0;") 1736 | cmd.do("dssr_block ${2:2n2d}, 0;") 1737 | cmd.do("set all_states;") 1738 | $0 1739 | 1740 | snippet dssrBlock4 1741 | abbr dssrBlock4 1742 | alias dssrBlock4 1743 | cmd.do("reinitialize;") 1744 | cmd.do("${1:run /Users/blaine/.pymol/startup/dssr_block.py};") 1745 | cmd.do("fetch ${2:1msy}, async=0;") 1746 | cmd.do("set cartoon_nucleic_acid_color, ${3:orange};") 1747 | cmd.do("dssr_block block_color=N red | minor 0.9 | major yellow;") 1748 | $0 1749 | 1750 | snippet nucleicAcidCartoon 1751 | abbr nucleicAcidCartoon 1752 | alias nucleicAcidCartoon 1753 | cmd.do("set cartoon_ladder_radius, ${2:0.2};") 1754 | cmd.do("set cartoon_nucleic_acid_color, ${3:red};") 1755 | cmd.do("# The cartoon ring modes range from 0 to 4.;") 1756 | cmd.do("set cartoon_ring_mode, ${4:2};") 1757 | $0 1758 | 1759 | snippet nucleicAcidCartoon2Strands 1760 | abbr nucleicAcidCartoon2Strands 1761 | alias nucleicAcidCartoon2Strands 1762 | cmd.do("fetch ${1:3nd3}, ${2:3nd3}, type=${3:pdb1};") 1763 | cmd.do("set all_states, on;") 1764 | cmd.do("create chA, ${2:3nd3}, 1, 1;") 1765 | cmd.do("create chB, ${2:3nd3}, 2, 1;") 1766 | cmd.do("# colors only the backbone;") 1767 | cmd.do("set cartoon_nucleic_acid_color, ${4:magenta}, chA;") 1768 | cmd.do("set cartoon_nucleic_acid_color, ${5:orange}, chB;") 1769 | cmd.do("# color the bases;") 1770 | cmd.do("set cartoon_ladder_color, ${6:density}, chA;") 1771 | cmd.do("set cartoon_ladder_color, ${7:yellow}, chB;") 1772 | $0 1773 | 1774 | snippet nucleicAcidColorbySequence 1775 | abbr nucleicAcidColorbySequence 1776 | alias nucleicAcidColorbySequence 1777 | cmd.do("select rna_A, resn A;") 1778 | cmd.do("select rna_C, resn C;") 1779 | cmd.do("select rna_G, resn G;") 1780 | cmd.do("select rna_U, resn U;") 1781 | cmd.do("select dna_T, resn T;") 1782 | cmd.do("color ${1:yellow}, rna_A;") 1783 | cmd.do("color ${2:red}, rna_C; ") 1784 | cmd.do("color ${3:gray40}, rna_G;") 1785 | cmd.do("color ${4:palecyan}, rna_U;") 1786 | cmd.do("color ${5:brown}, dna_T;") 1787 | $0 1788 | 1789 | snippet nucleicAcidFlatRibbonColorbySequence 1790 | abbr nucleicAcidFlatRibbonColorbySequence 1791 | alias nucleicAcidFlatRibbonColorbySequence 1792 | cmd.do("bg_color white;") 1793 | cmd.do("set cartoon_oval_length, ${1:1.85};") 1794 | cmd.do("set cartoon_oval_width, ${2:0.5};") 1795 | cmd.do("cartoon oval;") 1796 | cmd.do("set cartoon_ring_mode, ${3:3};") 1797 | cmd.do("# set the color of the backbone oval;") 1798 | cmd.do("set cartoon_nucleic_acid_color, ${4:blue};") 1799 | cmd.do("select rna_A, resn A;") 1800 | cmd.do("select rna_C, resn C;") 1801 | cmd.do("select rna_G, resn G;") 1802 | cmd.do("select rna_U, resn U;") 1803 | cmd.do("select dna_T, resn T;") 1804 | cmd.do("color ${5:yellow}, rna_A;") 1805 | cmd.do("color ${6:red}, rna_C; ") 1806 | cmd.do("color ${7:gray40}, rna_G;") 1807 | cmd.do("color ${8:palecyan}, rna_U;") 1808 | cmd.do("color ${9:brown}, dna_T;") 1809 | cmd.do("as cartoon;") 1810 | $0 1811 | 1812 | snippet nucleicAcidCartoonFilledRings 1813 | abbr nucleicAcidCartoonFilledRings 1814 | alias nucleicAcidCartoonFilledRings 1815 | cmd.do("bg_color white;") 1816 | cmd.do("show sticks;") 1817 | cmd.do("set cartoon_ring_mode, 3;") 1818 | cmd.do("set cartoon_ring_finder, 1;") 1819 | cmd.do("set cartoon_ladder_mode, 1;") 1820 | cmd.do("set cartoon_nucleic_acid_mode, 4;") 1821 | cmd.do("set cartoon_ring_transparency, 0.5;") 1822 | cmd.do("as cartoon;") 1823 | $0 1824 | 1825 | snippet basePairStacking 1826 | abbr basePairStacking 1827 | alias basePairStacking 1828 | cmd.do("delete all;") 1829 | cmd.do("fetch 4PCO, type=pdb, async=0;") 1830 | cmd.do("select G2G3, ( ((resi 2 or resi 3) and chain A) or ((resi 8 or resi 9) and chain B));") 1831 | cmd.do("remove not G2G3;") 1832 | cmd.do("bg_color white;") 1833 | cmd.do("show sticks;") 1834 | cmd.do("set stick_radius=0.14;") 1835 | cmd.do("set stick_ball, on; ") 1836 | cmd.do("set stick_ball_ratio,1.9;") 1837 | 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);") 1838 | cmd.do("remove name H*;") 1839 | cmd.do("select carbon1, element C and (resi 3 or resi 8) ") 1840 | cmd.do("# select lower base pair;") 1841 | cmd.do("select carbon2, element C and (resi 2 or resi 9) ") 1842 | cmd.do("#select upper base pair;") 1843 | cmd.do("color gray70, carbon1;") 1844 | cmd.do("color gray10, carbon2;") 1845 | cmd.do("show sticks;") 1846 | cmd.do("space cmyk;") 1847 | cmd.do("distance hbond1, /4PCO//B/U`9/N3,/4PCO//A/G`2/O6;") 1848 | cmd.do("distance hbond2, /4PCO//B/U`9/O2,/4PCO//A/G`2/N1;") 1849 | cmd.do("distance hbond3, /4PCO//A/U`3/N3,/4PCO//B/G`8/O6;") 1850 | cmd.do("distance hbond4, /4PCO//A/U`3/O2,/4PCO//B/G`8/N1;") 1851 | cmd.do("color black, hbond1;") 1852 | cmd.do("color black, hbond2;") 1853 | cmd.do("color gray70, hbond3;") 1854 | cmd.do("color gray70, hbond4;") 1855 | cmd.do("show nb_spheres;") 1856 | cmd.do("set nb_spheres_size, 0.35;") 1857 | cmd.do("hide labels;") 1858 | cmd.do("ray 1600,1000;") 1859 | cmd.do("png 4PCO.png;") 1860 | $0 1861 | 1862 | snippet nucleicAcidDumbellCartoonColorbySequence 1863 | abbr nucleicAcidDumbellCartoonColorbySequence 1864 | alias nucleicAcidDumbellCartoonColorbySequence 1865 | cmd.do("bg_color white;") 1866 | cmd.do("set cartoon_oval_length, ${1:1.85}") 1867 | cmd.do("set cartoon_oval_width, ${2:0.5}") 1868 | cmd.do("cartoon oval;") 1869 | cmd.do("cartoon dumbbell;") 1870 | cmd.do("set cartoon_dumbbell_width, 0.2;") 1871 | cmd.do("set cartoon_dumbbell_radius, 0.4;") 1872 | cmd.do("set cartoon_ring_mode, ${3:3};") 1873 | cmd.do("# set the color of the backbone oval") 1874 | cmd.do("set cartoon_nucleic_acid_color, ${4:blue};") 1875 | cmd.do("select rna_A, resn A;") 1876 | cmd.do("select rna_C, resn C;") 1877 | cmd.do("select rna_G, resn G;") 1878 | cmd.do("select rna_U, resn U;") 1879 | cmd.do("select dna_T, resn T;") 1880 | cmd.do("color ${5:yellow}, rna_A;") 1881 | cmd.do("color ${6:red}, rna_C; ") 1882 | cmd.do("color ${7:gray40}, rna_G;") 1883 | cmd.do("color ${8:palecyan}, rna_U;") 1884 | cmd.do("color ${9:brown}, dna_T;") 1885 | cmd.do("as cartoon;") 1886 | $0 1887 | 1888 | snippet stereokb 1889 | abbr stereokb 1890 | alias stereokb 1891 | cmd.set_key("F1",lambda:cmd.stereo({"on":0,"off":1}[cmd.get("stereo")])); $0 1892 | $0 1893 | 1894 | snippet listSettings2 1895 | abbr listSettings2 1896 | alias listSettings2 1897 | list = setting.get_name_list();[print("%s => %s" % (name, setting.get_setting_text(name))) for name in list]; $0 1898 | $0 1899 | 1900 | snippet listSettings 1901 | abbr listSettings 1902 | alias listSettings 1903 | [print("%s => %s" % (name, setting.get_setting_text(name))) for name in setting.get_name_list()]; $0 1904 | $0 1905 | 1906 | snippet listObjects 1907 | abbr listObjects 1908 | alias listObjects 1909 | cmd.do("objList = cmd.get_names(\"objects\");print(objList);") 1910 | $0 1911 | 1912 | snippet listLigandProteinDistances 1913 | abbr listLigandProteinDistances 1914 | alias listLigandProteinDistances 1915 | from pymol import cmd 1916 | """ 1917 | Find all distances betwen all ligand atoms and all protein atoms. 1918 | 1919 | Adapted and updated from script by Dan Kulp posted here 1920 | https://sourceforge.net/p/pymol/mailman/message/10097804/ 1921 | 1922 | There are probably better solutions like finding just the 1923 | distances to proein atoms within a certain distance from 1924 | the ligand. 1925 | 1926 | Due to the nested for loops, this script is takes several second 1927 | to run on a medium-sized human protein. This script is a 1928 | good candidate for vectorization. 1929 | 1930 | It is also a good candiate for becoming a function and a shortcut. 1931 | 1932 | """ 1933 | 1934 | # customize these lines to your protein. 1935 | cmd.fetch("6NEC") 1936 | cmd.select("prot","not resn XIN and not resn HOH and not chain C") 1937 | cmd.select("lig", "resn XIN and not chain C") 1938 | 1939 | dist_list = {} 1940 | pro_atoms = cmd.get_model("prot") 1941 | lig_atoms = cmd.get_model("lig") 1942 | 1943 | for l_at in lig_atoms.atom: 1944 | for p_at in pro_atoms.atom: 1945 | dist_list[str(l_at.resn) + 1946 | ":" + 1947 | str(l_at.resi) + 1948 | " " + 1949 | l_at.name + 1950 | " ---- " + 1951 | str(p_at.resn) + 1952 | ":" + 1953 | str(p_at.resi) + 1954 | " " + 1955 | p_at.name] = cmd.dist("foo", 1956 | "index " + 1957 | str(l_at.index),"index " + str(p_at.index)) 1958 | cmd.delete("foo") 1959 | print("List of all pairwise ligand--protein atom-atom distances:") 1960 | # [print("Distance of " + d + " is " + str(dist_list[d])) for d in dist_list.keys()] 1961 | 1962 | # More compact print statement. Need an f-string format statement. 1963 | [print( d + " " + str(dist_list[d])) for d in dist_list.keys()] $0 1964 | $0 1965 | 1966 | snippet nucleicAcidBackboneTubesSticks 1967 | abbr nucleicAcidBackboneTubesSticks 1968 | alias nucleicAcidBackboneTubesSticks 1969 | cmd.do("set bg_rgb, white;") 1970 | cmd.do("hide everything, all;") 1971 | cmd.do("# Change to the name of your molecular object.;") 1972 | cmd.do("show cartoon, ${1:3nd3};") 1973 | cmd.do("set cartoon_sampling,1;") 1974 | cmd.do("set cartoon_tube_radius, 0.5;") 1975 | cmd.do("set cartoon_ladder_mode, 0;") 1976 | cmd.do("# Set to 0.0 to turn off transparency;") 1977 | cmd.do("set cartoon_transparency, ${2:0.65};") 1978 | cmd.do("# The default strick radisu is 0.25. I think it is too thick.;") 1979 | cmd.do("set stick_radius ${3:0.12};") 1980 | cmd.do("show sticks;") 1981 | cmd.do("hide sticks, element H;") 1982 | $0 1983 | 1984 | snippet symexp 1985 | abbr symexp 1986 | alias symexp 1987 | cmd.do("symexp ${1:symm}, ${2:3fa0}, (${2:3fa0}), ${3:20},${4:1};") 1988 | $0 1989 | 1990 | snippet addAxis 1991 | abbr addAxis 1992 | alias addAxis 1993 | python 1994 | from pymol.cgo import * # get constants 1995 | from pymol import cmd 1996 | 1997 | import math 1998 | 1999 | class Counter: 2000 | """ 2001 | draw_line 2002 | source https://www.pymolwiki.org/index.php/Symmetry_Axis 2003 | 2004 | Pymol script copyright Matthew O"Meara and Xavier Ambroggio 2007 2005 | 2006 | Under GNU Free Documentation License 1.2 2007 | 2008 | Example: 2009 | 2010 | draw_axis(x=18.232, y=17.150, z=9.488,i=-.226639, j=0.708772, k=-.668039, r=1, b=0, g=0, width=1, length=100) 2011 | 2012 | Updated 15 June 2020 2013 | Blaine Mooers 2014 | 2015 | Notes: 2016 | 1) Could be useful for the adding a symmery axis, a ncs axis, or scale bar to a scene. 2017 | 2) The postion (xyz) is the middle of the line, not one end as expected for a vector. 2018 | 3) Another example: draw_axis(x=0, y=0, z=0,i=0, j=0, k=1, r=1, b=0, g=0, width=300, length=96) 2019 | 4) Changed print statement to Python3 print function. 2020 | 5) Replaced cmd.extend() with function generator. 2021 | """ 2022 | def __init__(self): 2023 | self.state = 1 2024 | counter = Counter() 2025 | 2026 | @cmd.extend 2027 | def draw_axis(x=None, y=None, z=None, i=None, j=None, k=None, length=20.0, r=1.0, g=1.0, b=1.0, width=1.0 ): 2028 | if x == None or y == None or z == None or i == None or j == None or k== None : 2029 | print("Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width") 2030 | print("draw a line centered at (x,y,z) with the direction vector (i,j,k)") 2031 | print("length, color (r,g,b), and width arguments are optional") 2032 | # print "For a fun example of the command, run draw_axis_example" 2033 | else : 2034 | x,y,z = float(x), float(y), float(z) 2035 | i,j,k = float(i), float(j), float(k) 2036 | r,g,b = float(r), float(g), float(b) 2037 | width = float(width) 2038 | length = float(length) / 2.0 2039 | 2040 | x1,y1,z1 = (x+i*length,y+j*length,z+k*length) 2041 | x2,y2,z2 = (x-i*length,y-j*length,z-k*length) 2042 | 2043 | obj = [ 2044 | LINEWIDTH, width, 2045 | BEGIN, LINES, 2046 | 2047 | COLOR, r, g, b, 2048 | VERTEX, x1, y1, z1, 2049 | VERTEX, x2, y2, z2, 2050 | 2051 | END 2052 | ] 2053 | 2054 | cmd.load_cgo(obj,"axis"+str(counter.state)) 2055 | counter.state += 1 2056 | python end 2057 | $0 2058 | 2059 | snippet synch 2060 | abbr synch 2061 | alias synch 2062 | cmd.sync(timeout=${1:1.0},poll=${2:0.05}); $0 2063 | $0 2064 | 2065 | snippet renumResi 2066 | abbr renumResi 2067 | alias renumResi 2068 | cmd.do("alter ${1:3fa0}, resi=str(int(resi)+${2:100});sort;") 2069 | $0 2070 | 2071 | snippet renumAtoms 2072 | abbr renumAtoms 2073 | alias renumAtoms 2074 | cmd.do("alter {$1:3fa0}, ID=ID+${2:100};") 2075 | cmd.do("sort;") 2076 | $0 2077 | 2078 | snippet renameChain 2079 | abbr renameChain 2080 | alias renameChain 2081 | cmd.do("alter ${1:3fa0} and chain ${2:A}, chain=${3:\"C\"};") 2082 | cmd.do("sort;") 2083 | $0 2084 | 2085 | snippet printAtomNumbers 2086 | abbr printAtomNumbers 2087 | alias printAtomNumbers 2088 | cmd.do("iterate (resi ${1:1}), print(name + \" %i${1:5}\" % ID);") 2089 | $0 2090 | 2091 | snippet printAtomNames 2092 | abbr printAtomNames 2093 | alias printAtomNames 2094 | cmd.do("iterate (resi ${1:101}), print(name);") 2095 | $0 2096 | 2097 | snippet printBfactors 2098 | abbr printBfactors 2099 | alias printBfactors 2100 | cmd.do("iterate (resi ${1:101}), print(name + \" %.2f\" % b);") 2101 | $0 2102 | 2103 | snippet printVDWradii 2104 | abbr printVDWradii 2105 | alias printVDWradii 2106 | cmd.do("iterate (resi ${1:101}), print(name + \" %.2f\" % vdw);") 2107 | $0 2108 | 2109 | snippet printCoordinates 2110 | abbr printCoordinates 2111 | alias printCoordinates 2112 | stored.coords = []; 2113 | iterate_state 1, (resi ${1:101}), stored.coords.append([x,y,z]); 2114 | [print(i) for i in stored.coords]; $0 2115 | $0 2116 | 2117 | snippet printNamesCoordinates 2118 | abbr printNamesCoordinates 2119 | alias printNamesCoordinates 2120 | cmd.do("stored.names = []; iterate_state 1, (resi ${1:101}), stored.names.append([name]); ") 2121 | cmd.do("stored.coords = []; iterate_state 1, (resi ${1:101})), stored.coords.append([x,y,z]); ") 2122 | cmd.do("[print(i,j) for i,j in zip(stored.names, stored.coords)];") 2123 | $0 2124 | 2125 | snippet printNamesCoordinates 2126 | abbr printNamesCoordinates 2127 | alias printNamesCoordinates 2128 | cmd.do("stored.coords = []; iterate_state 1, (resi ${1:101}), stored.coords.append([x,y,z]); ") 2129 | cmd.do("stored.names = []; iterate_state 1, (resi ${1:101}), stored.names.append([name]);") 2130 | cmd.do("stored.names3 = [tuple(i) for i in stored.names];") 2131 | cmd.do("[print(i,j) for i,j in(zip(stored.names3, stored.coords)];") 2132 | $0 2133 | 2134 | snippet emacsjupyterSourceBlock 2135 | abbr emacsjupyterSourceBlock 2136 | alias emacsjupyterSourceBlock 2137 | #+BEGIN_SRC jupyter-python :session py :kernel pymol.python :exports both :results raw drawer 2138 | from pymol import cmd 2139 | cmd.do("reinitialize") 2140 | cmd.bg_color("white") 2141 | cmd.do("fetch 6VXX") 2142 | cmd.do("zoom (resi 614 and chain A)") 2143 | cmd.label(selection="chain A and resi 614 and name CB", expression=""%s-%s" % (resn,resi)") 2144 | cmd.do("set label_color, black; set label_size, 48") 2145 | cmd.do("set stick_radius, 0.12") 2146 | cmd.do("hide cartoon; show sticks") 2147 | cmd.do("set ray_shadows, 0") 2148 | cmd.do("draw") 2149 | cmd.do("png /Users/blaine/D614Gipython3.png, 600, 360, dpi=600") 2150 | from IPython.display import Image 2151 | from IPython.core.display import HTML 2152 | PATH = "/Users/blaine/" 2153 | Image(filename = PATH + "D614Gipython3.png", width=600, unconfined=True) 2154 | #+END_SRC 2155 | 2156 | #+RESULTS: $0 2157 | $0 2158 | 2159 | snippet obipythonSourceBlock 2160 | abbr obipythonSourceBlock 2161 | alias obipythonSourceBlock 2162 | #+BEGIN_SRC ipython :session py :kernel pymol.python :exports both :results raw drawer 2163 | from pymol import cmd 2164 | cmd.do("reinitialize") 2165 | cmd.bg_color("white") 2166 | cmd.do("fetch 6VXX") 2167 | cmd.do("zoom (resi 614 and chain A)") 2168 | cmd.label(selection="chain A and resi 614 and name CB", expression=""%s-%s" % (resn,resi)") 2169 | cmd.do("set label_color, black; set label_size, 48") 2170 | cmd.do("set stick_radius, 0.12") 2171 | cmd.do("hide cartoon; show sticks") 2172 | cmd.do("set ray_shadows, 0") 2173 | cmd.do("draw") 2174 | cmd.do("png /Users/blaine/D614Gipython3.png, 600, 360, dpi=600") 2175 | from IPython.display import Image 2176 | from IPython.core.display import HTML 2177 | PATH = "/Users/blaine/" 2178 | Image(filename = PATH + "D614Gipython3.png", width=600, unconfined=True) 2179 | #+END_SRC 2180 | 2181 | #+RESULTS: $0 2182 | $0 2183 | 2184 | snippet importPyMOLcmd 2185 | abbr importPyMOLcmd 2186 | alias importPyMOLcmd 2187 | from pymol import cmd $0 2188 | $0 2189 | 2190 | snippet importIPythonDisplay 2191 | abbr importIPythonDisplay 2192 | alias importIPythonDisplay 2193 | from IPython.display import Image 2194 | from IPython.core.display import HTML 2195 | PATH = "/Users/blaine/" $0 2196 | $0 2197 | 2198 | snippet loadImage 2199 | abbr loadImage 2200 | alias loadImage 2201 | Image(filename = PATH +"${1:5da6orient}.png", width=${2:600}, height=${3:1000}, unconfined=True); $0 2202 | $0 2203 | 2204 | snippet imports4PyMOLjupyter 2205 | abbr imports4PyMOLjupyter 2206 | alias imports4PyMOLjupyter 2207 | from pymol import cmd 2208 | from IPython.display import Image 2209 | from IPython.core.display import HTML $0 2210 | $0 2211 | 2212 | snippet getCoordinatespy 2213 | abbr getCoordinatespy 2214 | alias getCoordinatespy 2215 | print(cmd.get_atom_coords(${1:\\"/4PCO//B/G`8/OP2\\"})); $0 2216 | $0 2217 | 2218 | snippet fastapy 2219 | abbr fastapy 2220 | alias fastapy 2221 | # Get the sequences of all molecular objects.; 2222 | print(cmd.get_fastastr("${1:all}")); $0 2223 | $0 2224 | 2225 | snippet fetchThreeMaps 2226 | abbr fetchThreeMaps 2227 | alias fetchThreeMaps 2228 | cmd.do("fetch ${1:4dgr}, type=pdb;") 2229 | cmd.do("# Make sure to rename map file so that ;") 2230 | cmd.do("# the root filename differs from pdb root filename;") 2231 | cmd.do("fetch ${1:4dgr}, ${1:4dgr}_2fofc, type=2fofc;") 2232 | cmd.do("fetch ${1:4dgr}, ${1:4dgr}_fofc, type=fofc;") 2233 | cmd.do("select ${2:glycan}, ${3:resid 200 or resid 469:477};") 2234 | cmd.do("isomesh ${4:mesh1}, 2fofc, 1.0, ${2:glycan};") 2235 | cmd.do("color density, ${4:mesh1};") 2236 | cmd.do("isomesh ${5:mesh2}, fofc, 3.0, ${2:glycan};") 2237 | cmd.do("color green, ${5:mesh2};") 2238 | cmd.do("isomesh ${6:mesh3}, fofc, -3.0, ${2:glycan};") 2239 | cmd.do("color red, ${6:mesh3};") 2240 | $0 2241 | 2242 | snippet scaleRadiusColorpy 2243 | abbr scaleRadiusColorpy 2244 | alias scaleRadiusColorpy 2245 | cmd.do("bg_color white;") 2246 | cmd.do("hide everything;") 2247 | cmd.do("show spheres;") 2248 | cmd.do("set stick_radius = 0.1;") 2249 | cmd.do("hide everything, HET;") 2250 | cmd.do("show spheres, HET;") 2251 | cmd.do("set sphere_quality=3;") 2252 | cmd.do("show sticks, resi 1102;") 2253 | cmd.do("from pymol import stored;") 2254 | cmd.do("# set the stored array equal to the b−values or use your own values; ") 2255 | cmd.do("stored.bb = [ ];") 2256 | cmd.do("iterate all, stored.bb.append(b);") 2257 | # scale the b−values; 2258 | cmd.do("M = max(stored.bb);") 2259 | cmd.do("scaledBB = map(lambda x: float (x/M), stored.bb);") 2260 | count = 0; 2261 | # set the sphere radii independently; 2262 | for x in scaledBB: 2263 | cmd.set("sphere_scale", x ,"ID %s"%count) 2264 | count = count + 1 2265 | cmd.do("spectrum b, selection=4gdx;") 2266 | cmd.do("space cmyk;") 2267 | cmd.do("set specular_intensity , 0.25;") $0 2268 | $0 2269 | 2270 | snippet scaleRadiusColorPythonInsertpy 2271 | abbr scaleRadiusColorPythonInsertpy 2272 | alias scaleRadiusColorPythonInsertpy 2273 | # scale the b−values; 2274 | M = max(stored.bb); 2275 | scaledBB = map(lambda x: float (x/M), stored.bb); 2276 | count = 0; 2277 | # set the sphere radii independently; 2278 | #[(cmd.set("sphere_scale", x ,"ID %s"%count); count = count + 1) for x in scaledBB] 2279 | for x in scaledBB: 2280 | cmd.set("sphere_scale", x ,"ID %s"%count) 2281 | count = count + 1 $0 2282 | $0 2283 | 2284 | snippet spngpy 2285 | abbr spngpy 2286 | alias spngpy 2287 | import datetime; 2288 | from pymol import cmd; 2289 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 2290 | s = str(DT); 2291 | cmd.save(stemName+s+".png"); $0 2292 | $0 2293 | 2294 | snippet displayFontspy 2295 | abbr displayFontspy 2296 | alias displayFontspy 2297 | for i in range(1,21): 2298 | name = "label%d" % i; 2299 | cmd.pseudoatom(name, label="label font id %d" % i, pos=(0,0,0)); 2300 | cmd.set("label_font_id", i, name); 2301 | cmd.set("label_size", 50); 2302 | cmd.set("grid_mode"); $0 2303 | $0 2304 | 2305 | snippet aveB4resiXpy 2306 | abbr aveB4resiXpy 2307 | alias aveB4resiXpy 2308 | # AveBResiX, prints the residue number and the average bfactor.; 2309 | # Uses reduce and lambda, builtin Python functional porgramming functions.; 2310 | # Note that you need to convert the length of the list of Bfactors from an integer to a float before division into the sum.; 2311 | Bfactors = []; 2312 | # edit the selection below, which is a range of residue numbers here.; 2313 | iterate (resi ${1:133}), Bfactors.append(b); 2314 | print( "Average B-factor of residue ", %{1:133} , " = ", "%.2f" %(reduce(lambda x, y: x + y, Bfactors) / float(len(Bfactors))) ); 2315 | $0 2316 | 2317 | snippet sc441 2318 | abbr sc441 2319 | alias sc441 2320 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 2321 | cmd.do("supercell 4, 4, 1, , ${2:orange}, ${3:supercell1}, 1;") 2322 | $0 2323 | 2324 | snippet sc444 2325 | abbr sc444 2326 | alias sc444 2327 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 2328 | cmd.do("supercell 4, 4, 4, , ${2:orange}, ${3:supercell1}, 1;") 2329 | $0 2330 | 2331 | snippet sc414 2332 | abbr sc414 2333 | alias sc414 2334 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 2335 | cmd.do("supercell 4, 1, 4, , ${2:orange}, ${3:supercell1}, 1;") 2336 | $0 2337 | 2338 | snippet sc144 2339 | abbr sc144 2340 | alias sc144 2341 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 2342 | cmd.do("supercell 1, 4, 4, , ${2:orange}, ${3:supercell1}, 1;") 2343 | $0 2344 | 2345 | snippet sc444 2346 | abbr sc444 2347 | alias sc444 2348 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 2349 | cmd.do("supercell 4, 4, 4, , ${2:orange}, ${3:supercell1}, 1;") 2350 | $0 2351 | 2352 | snippet sdaepy 2353 | abbr sdaepy 2354 | alias sdaepy 2355 | import datetime; 2356 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 2357 | s = str(DT); 2358 | cmd.save(stemName+s+".dae"); $0 2359 | $0 2360 | 2361 | snippet sccp4py 2362 | abbr sccp4py 2363 | alias sccp4py 2364 | import datetime; 2365 | from pymol import cmd; 2366 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 2367 | s = str(DT); 2368 | cmd.save(stemName+s+".ccp4"); $0 2369 | $0 2370 | 2371 | snippet salnpy 2372 | abbr salnpy 2373 | alias salnpy 2374 | import datetime; 2375 | from pymol import cmd; 2376 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 2377 | s = str(DT); 2378 | cmd.save(stemName+s+".aln"); $0 2379 | $0 2380 | 2381 | snippet lspymolrcpy 2382 | abbr lspymolrcpy 2383 | alias lspymolrcpy 2384 | print(invocation.options.deferred); $0 2385 | $0 2386 | 2387 | snippet printDocpy 2388 | abbr printDocpy 2389 | alias printDocpy 2390 | print(${1:my_func}.__doc__); $0 2391 | $0 2392 | 2393 | snippet printPathpy 2394 | abbr printPathpy 2395 | alias printPathpy 2396 | print(pymol.__path__) $0 2397 | $0 2398 | 2399 | snippet pymoldocspy 2400 | abbr pymoldocspy 2401 | alias pymoldocspy 2402 | [help(i) for i in dir(pymol)]; $0 2403 | $0 2404 | 2405 | snippet aobw 2406 | abbr aobw 2407 | alias aobw 2408 | cmd.do("# Note: requires the gscale() function from pymolshortcuts.py.") 2409 | cmd.do("# Download this script from http://GitHub.com/MooersLab/pymolshortcuts.") 2410 | cmd.do("# Load the functions from this script with the command \"run pymolshortcuts.py\"") 2411 | cmd.do("set_color oxygen, [1.0,0.4,0.4];") 2412 | cmd.do("set_color nitrogen, [0.5,0.5,1.0];") 2413 | cmd.do("remove solvent;") 2414 | cmd.do("as spheres;") 2415 | cmd.do("util.cbaw;") 2416 | cmd.do("bg white;") 2417 | cmd.do("gscale();") 2418 | cmd.do("set light_count,10;") 2419 | cmd.do("set spec_count,1;") 2420 | cmd.do("set shininess, 10;") 2421 | cmd.do("set specular,0.25;") 2422 | cmd.do("set ambient,0;") 2423 | cmd.do("set direct,0;") 2424 | cmd.do("set reflect,1.5;") 2425 | cmd.do("set ray_shadow_decay_factor, 0.1;") 2426 | cmd.do("set ray_shadow_decay_range, 2;") 2427 | cmd.do("set depth_cue, 0;") 2428 | cmd.do("ray;") 2429 | $0 2430 | 2431 | snippet aod 2432 | abbr aod 2433 | alias aod 2434 | cmd.do("set_color oxygen, [1.0,0.4,0.4];") 2435 | cmd.do("set_color nitrogen, [0.5,0.5,1.0];") 2436 | cmd.do("remove solvent;") 2437 | cmd.do("as spheres;") 2438 | cmd.do("util.cbaw;") 2439 | cmd.do("bg white;") 2440 | cmd.do("set light_count,10;") 2441 | cmd.do("set spec_count,1;") 2442 | cmd.do("set shininess, 10;") 2443 | cmd.do("set specular,0.25;") 2444 | cmd.do("set ambient,0;") 2445 | cmd.do("set direct,0;") 2446 | cmd.do("set reflect,1.5;") 2447 | cmd.do("set ray_shadow_decay_factor, 0.1;") 2448 | cmd.do("set ray_shadow_decay_range, 2;") 2449 | cmd.do("color gray00, symbol c") 2450 | cmd.do("color gray90, symbol h") 2451 | cmd.do("set depth_cue, 0;") 2452 | cmd.do("ray;") 2453 | $0 2454 | 2455 | snippet aodbw 2456 | abbr aodbw 2457 | alias aodbw 2458 | cmd.do("set_color oxygen, [1.0,0.4,0.4];") 2459 | cmd.do("set_color nitrogen, [0.5,0.5,1.0];") 2460 | cmd.do("remove solvent;") 2461 | cmd.do("as spheres;") 2462 | cmd.do("util.cbaw;") 2463 | cmd.do("bg white;") 2464 | cmd.do("gscale();") 2465 | cmd.do("set light_count,10;") 2466 | cmd.do("set spec_count,1;") 2467 | cmd.do("set shininess, 10;") 2468 | cmd.do("set specular,0.25;") 2469 | cmd.do("set ambient,0;") 2470 | cmd.do("set direct,0;") 2471 | cmd.do("set reflect,1.5;") 2472 | cmd.do("set ray_shadow_decay_factor, 0.1;") 2473 | cmd.do("set ray_shadow_decay_range, 2;") 2474 | cmd.do("set depth_cue, 0;") 2475 | cmd.do("ray;") 2476 | $0 2477 | 2478 | snippet addAxispy 2479 | abbr addAxispy 2480 | alias addAxispy 2481 | from pymol.cgo import * # get constants 2482 | from pymol import cmd 2483 | 2484 | import math 2485 | 2486 | class Counter: 2487 | """ 2488 | draw_line 2489 | source https://www.pymolwiki.org/index.php/Symmetry_Axis 2490 | 2491 | Pymol script copyright Matthew O"Meara and Xavier Ambroggio 2007 2492 | 2493 | Under GNU Free Documentation License 1.2 2494 | 2495 | Example: 2496 | 2497 | draw_axis(x=18.232, y=17.150, z=9.488,i=-.226639, j=0.708772, k=-.668039, r=1, b=0, g=0, width=1, length=100) 2498 | 2499 | Updated 15 June 2020 2500 | Blaine Mooers 2501 | 2502 | Notes: 2503 | 1) Could be useful for the adding a symmery axis, a ncs axis, or scale bar to a scene. 2504 | 2) The postion (xyz) is the middle of the line, not one end as expected for a vector. 2505 | 3) Another example: draw_axis(x=0, y=0, z=0,i=0, j=0, k=1, r=1, b=0, g=0, width=300, length=96) 2506 | 4) Changed print statement to Python3 print function. 2507 | 5) Replaced cmd.extend() with function generator. 2508 | """ 2509 | def __init__(self): 2510 | self.state = 1 2511 | counter = Counter() 2512 | 2513 | @cmd.extend 2514 | def draw_axis(x=None, y=None, z=None, i=None, j=None, k=None, length=20.0, r=1.0, g=1.0, b=1.0, width=1.0 ): 2515 | if x == None or y == None or z == None or i == None or j == None or k== None : 2516 | print("Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width") 2517 | print("draw a line centered at (x,y,z) with the direction vector (i,j,k)") 2518 | print("length, color (r,g,b), and width arguments are optional") 2519 | # print "For a fun example of the command, run draw_axis_example" 2520 | else : 2521 | x,y,z = float(x), float(y), float(z) 2522 | i,j,k = float(i), float(j), float(k) 2523 | r,g,b = float(r), float(g), float(b) 2524 | width = float(width) 2525 | length = float(length) / 2.0 2526 | 2527 | x1,y1,z1 = (x+i*length,y+j*length,z+k*length) 2528 | x2,y2,z2 = (x-i*length,y-j*length,z-k*length) 2529 | 2530 | obj = [ 2531 | LINEWIDTH, width, 2532 | BEGIN, LINES, 2533 | 2534 | COLOR, r, g, b, 2535 | VERTEX, x1, y1, z1, 2536 | VERTEX, x2, y2, z2, 2537 | 2538 | END 2539 | ] 2540 | 2541 | cmd.load_cgo(obj,"axis"+str(counter.state)) 2542 | counter.state += 1 $0 2543 | $0 2544 | 2545 | snippet grayscalepy 2546 | abbr grayscalepy 2547 | alias grayscalepy 2548 | def grayscale(selection="all"): 2549 | """Apply by entering grayscale()""" 2550 | cmd.color("grey64", "elem Ac") 2551 | cmd.color("grey67", "elem Al") 2552 | cmd.color("grey39", "elem Am") 2553 | cmd.color("grey46", "elem Sb") 2554 | cmd.color("grey75", "elem Ar") 2555 | cmd.color("grey58", "elem As") 2556 | cmd.color("grey33", "elem At") 2557 | cmd.color("grey56", "elem Ba") 2558 | cmd.color("grey40", "elem Bk") 2559 | cmd.color("grey87", "elem Be") 2560 | cmd.color("grey40", "elem Bi") 2561 | cmd.color("grey20", "elem Bh") 2562 | cmd.color("grey77", "elem B") 2563 | cmd.color("grey26", "elem Br") 2564 | cmd.color("grey86", "elem Cd") 2565 | cmd.color("grey76", "elem Ca") 2566 | cmd.color("grey34", "elem Cf") 2567 | cmd.color("grey77", "elem C") 2568 | cmd.color("grey98", "elem Ce") 2569 | cmd.color("grey17", "elem Cs") 2570 | cmd.color("grey70", "elem Cl") 2571 | cmd.color("grey60", "elem Cr") 2572 | cmd.color("grey64", "elem Co") 2573 | cmd.color("grey54", "elem Cu") 2574 | cmd.color("grey42", "elem Cm") 2575 | cmd.color("grey89", "elem D") 2576 | cmd.color("grey19", "elem Db") 2577 | cmd.color("grey79", "elem Dy") 2578 | cmd.color("grey29", "elem Es") 2579 | cmd.color("grey67", "elem Er") 2580 | cmd.color("grey85", "elem Eu") 2581 | cmd.color("grey28", "elem Fm") 2582 | cmd.color("grey93", "elem F") 2583 | cmd.color("grey8", "elem Fr") 2584 | cmd.color("grey82", "elem Gd") 2585 | cmd.color("grey60", "elem Ga") 2586 | cmd.color("grey52", "elem Ge") 2587 | cmd.color("grey80", "elem Au") 2588 | cmd.color("grey68", "elem Hf") 2589 | cmd.color("grey20", "elem Hs") 2590 | cmd.color("grey96", "elem He") 2591 | cmd.color("grey75", "elem Ho") 2592 | cmd.color("grey89", "elem H") 2593 | cmd.color("grey49", "elem In") 2594 | cmd.color("grey16", "elem I") 2595 | cmd.color("grey29", "elem Ir") 2596 | cmd.color("grey48", "elem Fe") 2597 | cmd.color("grey65", "elem Kr") 2598 | cmd.color("grey76", "elem La") 2599 | cmd.color("grey19", "elem Lr") 2600 | cmd.color("grey34", "elem Pb") 2601 | cmd.color("grey60", "elem Li") 2602 | cmd.color("grey48", "elem Lu") 2603 | cmd.color("grey83", "elem Mg") 2604 | cmd.color("grey52", "elem Mn") 2605 | cmd.color("grey20", "elem Mt") 2606 | cmd.color("grey23", "elem Md") 2607 | cmd.color("grey72", "elem Hg") 2608 | cmd.color("grey62", "elem Mo") 2609 | cmd.color("grey93", "elem Nd") 2610 | cmd.color("grey85", "elem Ne") 2611 | cmd.color("grey43", "elem Np") 2612 | cmd.color("grey67", "elem Ni") 2613 | cmd.color("grey69", "elem Nb") 2614 | cmd.color("grey25", "elem N") 2615 | cmd.color("grey23", "elem No") 2616 | cmd.color("grey36", "elem Os") 2617 | cmd.color("grey44", "elem O") 2618 | cmd.color("grey33", "elem Pd") 2619 | cmd.color("grey57", "elem P") 2620 | cmd.color("grey82", "elem Pt") 2621 | cmd.color("grey37", "elem Pu") 2622 | cmd.color("grey40", "elem Po") 2623 | cmd.color("grey35", "elem K") 2624 | cmd.color("grey95", "elem Pr") 2625 | cmd.color("grey90", "elem Pm") 2626 | cmd.color("grey52", "elem Pa") 2627 | cmd.color("grey35", "elem Ra") 2628 | cmd.color("grey46", "elem Rn") 2629 | cmd.color("grey43", "elem Re") 2630 | cmd.color("grey39", "elem Rh") 2631 | cmd.color("grey27", "elem Rb") 2632 | cmd.color("grey47", "elem Ru") 2633 | cmd.color("grey19", "elem Rf") 2634 | cmd.color("grey89", "elem Sm") 2635 | cmd.color("grey90", "elem Sc") 2636 | cmd.color("grey20", "elem Sg") 2637 | cmd.color("grey66", "elem Se") 2638 | cmd.color("grey80", "elem Si") 2639 | cmd.color("grey75", "elem Ag") 2640 | cmd.color("grey46", "elem Na") 2641 | cmd.color("grey71", "elem Sr") 2642 | cmd.color("grey76", "elem S") 2643 | cmd.color("grey60", "elem Ta") 2644 | cmd.color("grey53", "elem Tc") 2645 | cmd.color("grey51", "elem Te") 2646 | cmd.color("grey81", "elem Tb") 2647 | cmd.color("grey39", "elem Tl") 2648 | cmd.color("grey59", "elem Th") 2649 | cmd.color("grey61", "elem Tm") 2650 | cmd.color("grey48", "elem Sn") 2651 | cmd.color("grey75", "elem Ti") 2652 | cmd.color("grey50", "elem W") 2653 | cmd.color("grey47", "elem U") 2654 | cmd.color("grey65", "elem V") 2655 | cmd.color("grey54", "elem Xe") 2656 | cmd.color("grey55", "elem Yb") 2657 | cmd.color("grey91", "elem Y") 2658 | cmd.color("grey51", "elem Zn") 2659 | cmd.color("grey81", "elem Zr") 2660 | $0 2661 | 2662 | snippet importShortcuts 2663 | abbr importShortcuts 2664 | alias importShortcuts 2665 | cmd.do("run /Users/blaine/Scripts/PyMOLScripts/pymolshortcuts.py") $0 2666 | $0 2667 | 2668 | snippet AO 2669 | abbr AO 2670 | alias AO 2671 | cmd.do("AO") $0 2672 | $0 2673 | 2674 | snippet AOBW 2675 | abbr AOBW 2676 | alias AOBW 2677 | cmd.do("AOBW") $0 2678 | $0 2679 | 2680 | snippet AOD 2681 | abbr AOD 2682 | alias AOD 2683 | cmd.do("AOD") $0 2684 | $0 2685 | 2686 | snippet AODBW 2687 | abbr AODBW 2688 | alias AODBW 2689 | cmd.do("AODBW") $0 2690 | $0 2691 | 2692 | snippet unitCellEdgesColorBlack 2693 | abbr unitCellEdgesColorBlack 2694 | alias unitCellEdgesColorBlack 2695 | cmd.do("# show the unit cell;") 2696 | cmd.do("show cell;") 2697 | cmd.do("color black, ${1:1lw9};") 2698 | cmd.do("# color by atom with carbons colored green,") 2699 | cmd.do("util.${2:cbag};") 2700 | cmd.do("set cgo_line_width, 2.5;") 2701 | cmd.do("# string filename, int width, int height, float dpi, int ray") 2702 | cmd.do("png ${3:testCell3}.png, ${4:1600},${5:1600},${6:600},${7:0}") 2703 | $0 2704 | 2705 | snippet printColorByAtomCodes 2706 | abbr printColorByAtomCodes 2707 | alias printColorByAtomCodes 2708 | print("util.cbag, green carbons atoms" + "\n" + "util.cbac, cyan carbon atoms" + "\n" + "util.cbam, magenta carbon atoms" + "\n" + "util.cbay, yellow carbons atoms" + "\n"+ "util.cbas, salmon carbons atoms" + "\n" + "util.cbaw, white carbons atoms" + "\n" + "util.cbab, slate carbons atoms" + "\n" + "util.cbao, bright orange carbons atoms" + "\n" + "util.cbap, purple carbons atoms" + "\n" +"util.cbak, pink carbons atoms") $0 2709 | $0 2710 | 2711 | snippet yrb 2712 | abbr yrb 2713 | alias yrb 2714 | cmd.do("yrb") $0 2715 | $0 2716 | 2717 | snippet timcolor 2718 | abbr timcolor 2719 | alias timcolor 2720 | cmd.do("timcolor") $0 2721 | $0 2722 | 2723 | snippet colorh1 2724 | abbr colorh1 2725 | alias colorh1 2726 | cmd.do("colorh1") $0 2727 | $0 2728 | 2729 | snippet colorh2 2730 | abbr colorh2 2731 | alias colorh2 2732 | cmd.do("colorh2") $0 2733 | $0 2734 | 2735 | snippet cav 2736 | abbr cav 2737 | alias cav 2738 | cmd.do("cav") $0 2739 | $0 2740 | 2741 | snippet PE125 2742 | abbr PE125 2743 | alias PE125 2744 | cmd.do("PE125") $0 2745 | $0 2746 | 2747 | snippet PE25 2748 | abbr PE25 2749 | alias PE25 2750 | cmd.do("PE25") $0 2751 | $0 2752 | 2753 | snippet PE50 2754 | abbr PE50 2755 | alias PE50 2756 | cmd.do("PE50") $0 2757 | $0 2758 | 2759 | snippet PE75 2760 | abbr PE75 2761 | alias PE75 2762 | cmd.do("PE75") $0 2763 | $0 2764 | 2765 | snippet PE85 2766 | abbr PE85 2767 | alias PE85 2768 | cmd.do("PE85") $0 2769 | $0 2770 | 2771 | snippet PE66 2772 | abbr PE66 2773 | alias PE66 2774 | cmd.do("PE66") $0 2775 | $0 2776 | 2777 | snippet PE33 2778 | abbr PE33 2779 | alias PE33 2780 | cmd.do("PE33") $0 2781 | $0 2782 | 2783 | snippet cntccp4emaps 2784 | abbr cntccp4emaps 2785 | alias cntccp4emaps 2786 | print("Count the number of ccp4 electron density files in current directory."); 2787 | print("Usage: cntccp4s"); 2788 | myPath = os.getcwd(); 2789 | ccp4Counter = len(glob.glob1(myPath,"*.pse")); 2790 | print("Number of number of ccp4 electron density files in the current directory: ", ccp4Counter); $0 2791 | $0 2792 | 2793 | snippet cntfiles 2794 | abbr cntfiles 2795 | alias cntfiles 2796 | print("Count the files in the directory.") 2797 | print("Usage: cntfiles.") 2798 | # simple version for working with CWD 2799 | print("Number of files in current working directory: ", len([name for name in os.listdir(".") if os.path.isfile(name)])) $0 2800 | $0 2801 | 2802 | snippet cntlogs 2803 | abbr cntlogs 2804 | alias cntlogs 2805 | print("Count the number of log image files in current directory."); 2806 | print("Usage: cntlogs"); 2807 | myPath = os.getcwd(); 2808 | logCounter = len(glob.glob1(myPath,"*.log")); 2809 | print("Number of number of log image files in the current directory: ", logCounter); $0 2810 | $0 2811 | 2812 | snippet cntmtzs 2813 | abbr cntmtzs 2814 | alias cntmtzs 2815 | print("Count the number of mtz structure factor files in current directory."); 2816 | print("Usage: cntmtzs"); 2817 | myPath = os.getcwd(); 2818 | mtzCounter = len(glob.glob1(myPath,"*.mtz")); 2819 | print("Number of number of mtz structure factor files in the current directory: ", mtzCounter); $0 2820 | $0 2821 | 2822 | snippet cntpdbs 2823 | abbr cntpdbs 2824 | alias cntpdbs 2825 | print("Count the number of pdb files in the current directory.") 2826 | print("Usage: cntpdb") 2827 | myPath = os.getcwd() 2828 | pdbCounter = len(glob.glob1(myPath,"*.pdb")) 2829 | print("Number of pdb files in the current directory: ", pdbCounter) $0 2830 | $0 2831 | 2832 | snippet cntpmls 2833 | abbr cntpmls 2834 | alias cntpmls 2835 | print("Count the number of pml (Pymol macro language) files in current directory."); 2836 | print("Usage: cntpmls"); 2837 | myPath = os.getcwd(); 2838 | pmlCounter = len(glob.glob1(myPath,"*.pml")); 2839 | print("Number of pml files in the current directory: ", pmlCounter); $0 2840 | $0 2841 | 2842 | snippet cntpngs 2843 | abbr cntpngs 2844 | alias cntpngs 2845 | print("Count the number of png image files in current directory."); 2846 | print("Usage: cntpngs"); 2847 | myPath = os.getcwd(); 2848 | pngCounter = len(glob.glob1(myPath,"*.png")); 2849 | print("Number of number of png image files in the current directory: ", pngCounter); $0 2850 | $0 2851 | 2852 | snippet cntpses 2853 | abbr cntpses 2854 | alias cntpses 2855 | print("Count the number of *.pse (session) files in current directory."); 2856 | print("Usage: cntpses"); 2857 | myPath = os.getcwd(); 2858 | pseCounter = len(glob.glob1(myPath,"*.pse")); 2859 | print("Number of *.pse (session) files in the current directory: ", pseCounter); $0 2860 | $0 2861 | 2862 | snippet rmhb 2863 | abbr rmhb 2864 | alias rmhb 2865 | cmd.delete("hbonds") $0 2866 | $0 2867 | 2868 | snippet hb 2869 | abbr hb 2870 | alias hb 2871 | cmd.distance("hbonds", "all", "all", "3.2", mode="2") 2872 | cmd.set("dash_gap","0.4") 2873 | cmd.set("dash_color","grey30") 2874 | cmd.set("dash_width","1.5") 2875 | cmd.set("dash_length",".25") 2876 | print("Enter rmhb to remove the hbonds.") $0 2877 | $0 2878 | 2879 | snippet rmd 2880 | abbr rmd 2881 | alias rmd 2882 | cmd.do("delete measure*") 2883 | cmd.do("delete m*_*") 2884 | cmd.do("delete dist*") $0 2885 | $0 2886 | 2887 | snippet nmr 2888 | abbr nmr 2889 | alias nmr 2890 | cmd.do("set all_states, on") 2891 | $0 2892 | 2893 | snippet nmroffpy 2894 | abbr nmroffpy 2895 | alias nmroffpy 2896 | cmd.do("set all_states, off") $0 2897 | $0 2898 | 2899 | snippet nmrpy 2900 | abbr nmrpy 2901 | alias nmrpy 2902 | cmd.do("cmd.do(\"set all_states, on\")") 2903 | $0 2904 | 2905 | snippet loadAndAlignManyFiles1 2906 | abbr loadAndAlignManyFiles1 2907 | alias loadAndAlignManyFiles1 2908 | # Copyright (c) 2004 Robert L. Campbell 2909 | # 2910 | # Modified for use with Python3. 2911 | # Jan. 29, 2020 2912 | # Blaine Mooers, PhD 2913 | # Univ. of Oklahoma Health Sciences Center 2914 | # 2915 | # 2916 | from pymol import cmd 2917 | import glob 2918 | 2919 | def loadFiles(files): 2920 | """ 2921 | load_files 2922 | 2923 | loads multiple files (using filename globbing) 2924 | into a multiple objects named as the files are (e.g. collection of 2925 | downloaded PDB files). 2926 | 2927 | e.g. load_files prot_*.pdb 2928 | """ 2929 | file_list = glob.glob(files) 2930 | if file_list: 2931 | file_list.sort() 2932 | for i in file_list: 2933 | cmd.load(i) 2934 | else: 2935 | print("No files found for pattern %s" % files) 2936 | $0 2937 | $0 2938 | 2939 | snippet loadAndAlignManyFiles2 2940 | abbr loadAndAlignManyFiles2 2941 | alias loadAndAlignManyFiles2 2942 | cmd.do("run ${1:~/Scripts/}optAlignRNA.py;") 2943 | cmd.do("[[optAlignRNA(x, y) for x in cmd.get_names()] for y in cmd.get_names()];") 2944 | $0 2945 | 2946 | snippet ao 2947 | abbr ao 2948 | alias ao 2949 | cmd.do("set_color oxygen, [1.0,0.4,0.4];") 2950 | cmd.do("set_color nitrogen, [0.5,0.5,1.0];") 2951 | cmd.do("remove solvent;") 2952 | cmd.do("as spheres;") 2953 | cmd.do("util.cbaw;") 2954 | cmd.do("bg white;") 2955 | cmd.do("set light_count,10;") 2956 | cmd.do("set spec_count,1;") 2957 | cmd.do("set shininess, 10;") 2958 | cmd.do("set specular,0.25;") 2959 | cmd.do("set ambient,0;") 2960 | cmd.do("set direct,0;") 2961 | cmd.do("set reflect,1.5;") 2962 | cmd.do("set ray_shadow_decay_factor, 0.1;") 2963 | cmd.do("set ray_shadow_decay_range, 2;") 2964 | cmd.do("set depth_cue, 0;") 2965 | cmd.do("ray;") 2966 | $0 2967 | 2968 | snippet bsfr 2969 | abbr bsfr 2970 | alias bsfr 2971 | cmd.do("# Edit the selection that is named ligand here.;") 2972 | cmd.do("create ligand, ${1:/bluComplex/C/A/1101};") 2973 | cmd.do("preset.ball_and_stick(selection=\"ligand\");") 2974 | cmd.do("util.cbaw ligand;") 2975 | cmd.do("set stick_color, white, ligand;") 2976 | cmd.do("set valence, off, ligand;") 2977 | cmd.do("unset valence;") 2978 | cmd.do("# above command is required after using preset;") 2979 | cmd.do("set sphere_color, black, elem C and ligand;") 2980 | cmd.do("set sphere_color, red, elem O and ligand;") 2981 | cmd.do("set sphere_color, blue, elem N and ligand;") 2982 | cmd.do("set sphere_color, lightblue, elem F and ligand;") 2983 | cmd.do("set stick_radius, 0.12;") 2984 | cmd.do("set sphere_quality, 4;") 2985 | cmd.do("set cartoon_ring_finder, 4, ligand;") 2986 | cmd.do("set cartoon_ring_mode, 3, ligand;") 2987 | cmd.do("set cartoon_ring_width, 0.12, ligand;") 2988 | cmd.do("set cartoon_ring_transparency, .0, ligand;") 2989 | cmd.do("show cartoon, ligand;") 2990 | $0 2991 | 2992 | snippet wallartpy 2993 | abbr wallartpy 2994 | alias wallartpy 2995 | # Reset hash_max from 100 to 2000 to enable the saving of images of large size for office wall hangings, eg. 30 x 30 inches.; 2996 | cmd.do("hash_max=2000"); 2997 | $0 2998 | 2999 | snippet cblindCartoon 3000 | abbr cblindCartoon 3001 | alias cblindCartoon 3002 | cmd.do("CB;") 3003 | cmd.do("color cb_lightblue, ss h;") 3004 | cmd.do("color cb_vermillion, ss s;") 3005 | cmd.do("color lightorange, ss l+\"\";") 3006 | $0 3007 | 3008 | snippet importPyMOLandShortcuts 3009 | abbr importPyMOLandShortcuts 3010 | alias importPyMOLandShortcuts 3011 | from pymol import cmd 3012 | from IPython.display import Image 3013 | PATH = "${1:/Users/blaine/}" 3014 | cmd.do("run ${2:/Users/blaine/Scripts/PyMOLScripts/pymolshortcuts.py") $0 3015 | $0 3016 | 3017 | snippet lsSnipsPy 3018 | abbr lsSnipsPy 3019 | alias lsSnipsPy 3020 | rm $0 3021 | $0 3022 | 3023 | --------------------------------------------------------------------------------