├── python-mode ├── fasta ├── nmroff ├── fog ├── nmr ├── rv ├── yrb ├── wallart ├── printDoc ├── undoSelection ├── nmrpy ├── printDocpy ├── rmhb ├── selectChain ├── antialias ├── rmwater ├── sas ├── selectLoops ├── selectName ├── turnAboutAxis ├── importPyMOLcmd ├── nmroffpy ├── printPathpy ├── sigang ├── ligandSelect ├── selectElement ├── selectHelices ├── selectStrands ├── sigdist ├── hideSelection ├── labelSS ├── selectResi ├── selectResidues ├── fetchFoFc ├── labelCAs ├── doubleBond ├── fetchCIF ├── labelWatersW ├── rotate ├── aobw ├── fetchPath ├── findHbonds ├── helpDocs ├── printAtomNames ├── printBs ├── cav ├── extractPartObj ├── renumResi ├── setpath ├── aod ├── cmddocs ├── labelWatersHOH ├── printBfactors ├── renameChain ├── renumAtoms ├── rmd ├── stateOne ├── github ├── pymoldocs ├── stereokb ├── printBspartB ├── pymoldocspy ├── internalGUImode2 ├── solventRadius ├── selectAtomsAround ├── sigdihedral ├── stereoRay ├── printAtomNumbers ├── internalGUIwidth ├── labelMainChain ├── printVDWradii ├── synch ├── PE25 ├── PE33 ├── PE50 ├── PE66 ├── PE75 ├── PE85 ├── labelResnResi ├── listObjects ├── selectResiduesAround ├── volumeRamp ├── PE125 ├── ringMode ├── setcolor ├── sigDigits ├── colorh1 ├── colorh2 ├── pseudolabel ├── selectAllBut ├── timcolor ├── aodbw ├── discreteCartoonColoring ├── numResiProtein ├── printBs2digits ├── sdaepy ├── setLigandValenceOn ├── cribbon ├── duplicateObject ├── sidehChainHelper ├── fastapy ├── writeCommandReference2HTML ├── loadAmberTrajs ├── numResiNucleic ├── presetDocs ├── stereoDraw ├── centerpi ├── getCoordinatespy ├── printPath ├── spngpy ├── displayFonts ├── listSettings2 ├── hbonddash ├── printCoordinates ├── saxsEnvelope ├── ellipcol ├── fetch2FoFcIsomesh ├── numResiNucleicChainA ├── numResiProteinChainA ├── salnpy ├── bu ├── listSettings ├── sccp4py ├── hidealtloc ├── importIPythonDisplay ├── sc144 ├── sc211 ├── sc414 ├── sc113 ├── sc131 ├── sc222 ├── bs ├── imports4PyMOLjupyter ├── sc122 ├── sc133 ├── sc221 ├── sc311 ├── sc313 ├── sc323 ├── sc331 ├── sc332 ├── sc333 ├── sc444 ├── importShortcuts ├── printNameB4ResiX ├── sc112 ├── sc114 ├── sc121 ├── sc141 ├── sc212 ├── sc233 ├── sc411 ├── sc441 ├── waterTriple ├── sc111 ├── hb ├── pearl ├── oneBondThicknessColor ├── allPairs ├── cntfiles ├── cntpdbs ├── molscriptRibbon ├── spse ├── ipymolStart ├── ms ├── printResiResnNameB4ResiX ├── drawHbonds ├── cntlogs ├── cntpmls ├── cntpngs ├── cntpses ├── filledRing ├── importPyMOLandShortcuts ├── cntmtzs ├── loadAndAlignManyFiles2 ├── fetch2FoFcVolume ├── printResiResnNameB4ResiXNoH ├── cblind ├── cntccp4emaps ├── distance ├── dssrBlock2 ├── his31asp70 ├── drawLinks ├── fetch2FoFcIsosurface ├── oneLetter ├── kernel ├── cblindCartoon ├── dssrBlock3 ├── dssrBlock4 ├── displayFontspy ├── nucleicAcidCartoon ├── aveB4resiXpy ├── printNamesCoordinates ├── symexp ├── scaleRadiusColorPythonInsertpy ├── brokenNucleicBackbone ├── cspheres ├── averageB ├── printColorByAtomCodes ├── nucleicAcidColorbySequence ├── unitCellEdgesColorBlack ├── rdkrpcProtein ├── savePNG ├── puttyCartoon ├── dssrBlock1 ├── nucleicAcidCartoonFilledRings ├── saveSeppy ├── rdkrpcChem ├── ao ├── threeMapsVolume ├── fetchThreeMaps ├── threeMapsIsosurface ├── ipymolProtein ├── grayscale ├── nucleicAcidBackboneTubesSticks ├── loadAndAlignManyFiles1 ├── loadAndAlignManyFiles3 ├── obipythonSourceBlock ├── emacsjupyterSourceBlock ├── nucleicAcidFlatRibbonColorbySequence ├── bsfr ├── scaleRadiusColorpy ├── nucleicAcidDumbellCartoonColorbySequence ├── nucleicAcidCartoon2Strands ├── basePairStacking ├── stack ├── rvr ├── carvedIsomesh ├── carvedIsosurface ├── listLigandProteinDistances ├── carvedVolume ├── addAxispy ├── grayscalepy ├── coordinate ├── rvi └── optAlignRNA ├── LICENSE └── README.md /python-mode/fasta: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fasta 4 | # name: Print Fasta from PDB file. 5 | # group: Print 6 | # key: fasta 7 | # -- 8 | $0 9 | -------------------------------------------------------------------------------- /python-mode/nmroff: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nmroff 4 | # name: Hide all but first model in a nmr structure. 5 | # group: Jupyter 6 | # key: nmroff 7 | # -- 8 | $0 9 | -------------------------------------------------------------------------------- /python-mode/fog: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fog 4 | # name: Blur the background atoms. 5 | # group: MolecularRepresentation 6 | # key: fog 7 | # -- 8 | cmd.do("set fog, 0;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/nmr: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nmr 4 | # name: Show all models in a nmr structure. 5 | # group: Jupyter 6 | # key: nmr 7 | # -- 8 | cmd.do("set all_states, on") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/rv: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rv 4 | # name: Return settings in rounded format. 5 | # group: ChangeOrientation 6 | # key: rv 7 | # -- 8 | cmd.do("run roundview.py;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/yrb: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: yrb 4 | # name: Run the yrb function from the pymolshortcuts.py file. 5 | # group: Jupyter 6 | # key: yrb 7 | # -- 8 | cmd.do("yrb") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/wallart: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: wallart 4 | # name: Reset hash_max from 100 to 2000 to enable the saving of 28 inches by 28 inches. 5 | # group: FileIO 6 | # key: wallart 7 | # -- 8 | $0 9 | -------------------------------------------------------------------------------- /python-mode/printDoc: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printDoc 4 | # name: Print document string of a function. 5 | # group: Help 6 | # key: printDoc 7 | # -- 8 | print(${1:my_func}.__doc__); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/undoSelection: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: undoSelection 4 | # name: Undo a selection. 5 | # group: Selection 6 | # key: undoSelection 7 | # -- 8 | cmd.do("disable ${1:sele}; ") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/nmrpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nmrpy 4 | # name: Show all models in a nmr structure. 5 | # group: Jupyter 6 | # key: nmrpy 7 | # -- 8 | cmd.do("cmd.do(\"set all_states, on\")") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printDocpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printDocpy 4 | # name: Print document string of a function. 5 | # group: Help 6 | # key: printDocpy 7 | # -- 8 | print(${1:my_func}.__doc__); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/rmhb: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rmhb 4 | # name: Delete all H-bonds in the selection, which is all by default. 5 | # group: Jupyter 6 | # key: rmhb 7 | # -- 8 | cmd.delete("hbonds") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectChain: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectChain 4 | # name: Select a chain. 5 | # group: Selection 6 | # key: selectChain 7 | # -- 8 | cmd.do("select ${1:rna}, ${2:chain B};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/antialias: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: antialias 4 | # name: Set antialias to on to get smoother edges. 5 | # group: Pymolrc 6 | # key: antialias 7 | # -- 8 | cmd.do("set antialias, 1;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/rmwater: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rmwater 4 | # name: Remove waters from molecular object. 5 | # group: MolecularRepresentation 6 | # key: rmwater 7 | # -- 8 | cmd.do("remove resn HOH;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/sas: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sas 4 | # name: Show the solvent excluded surface. 5 | # group: MolecularRepresentation 6 | # key: sas 7 | # -- 8 | cmd.do("set surface_solvent, ${1:on}") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectLoops: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectLoops 4 | # name: Select atoms by beta loops. 5 | # group: Selection 6 | # key: selectLoops 7 | # -- 8 | cmd.do("select ${1:loops}, ss l;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectName: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectName 4 | # name: Select atoms by name. 5 | # group: Selection 6 | # key: selectName 7 | # -- 8 | cmd.do("select ${1:oxygen2}, name ${2:O2};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/turnAboutAxis: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: turnAboutAxis 4 | # name: Turn about axis. 5 | # group: ChangeOrientation 6 | # key: turnAboutAxis 7 | # -- 8 | cmd.do("turn ${1:x},${2:90};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/importPyMOLcmd: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: importPyMOLcmd 4 | # name: Import the cmd class from the pymol api. 5 | # group: Jupyter 6 | # key: importPyMOLcmd 7 | # -- 8 | from pymol import cmd 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/nmroffpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nmroffpy 4 | # name: Hide all but the first model in a nmr structure. 5 | # group: Jupyter 6 | # key: nmroffpy 7 | # -- 8 | cmd.do("set all_states, off") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printPathpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printPathpy 4 | # name: Print the path to the currently used PyMOL binary. 5 | # group: Print 6 | # key: printPathpy 7 | # -- 8 | print(pymol.__path__) 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/sigang: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sigang 4 | # name: Set angle labels to display 2 decimals places. 5 | # group: Labels 6 | # key: sigang 7 | # -- 8 | cmd.do("set label_angle_digits, ${1:2};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/ligandSelect: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: ligandSelect 4 | # name: Make selection of ligand atoms. 5 | # group: Selection 6 | # key: ligandSelect 7 | # -- 8 | cmd.do("select ${1:ligand}, organic;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectElement: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectElement 4 | # name: Select atoms by element. 5 | # group: Selection 6 | # key: selectElement 7 | # -- 8 | cmd.do("select ${1:oxygen}, elem ${2:O};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectHelices: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectHelices 4 | # name: Select atoms by alpha helices. 5 | # group: Selection 6 | # key: selectHelices 7 | # -- 8 | cmd.do("select ${1:helices}, ss h; ") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectStrands: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectStrands 4 | # name: Select atoms by beta strands. 5 | # group: Selection 6 | # key: selectStrands 7 | # -- 8 | cmd.do("select ${1:strands}, ss s; ") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/sigdist: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sigdist 4 | # name: Set distance labels to display 2 decimals. 5 | # group: Labels 6 | # key: sigdist 7 | # -- 8 | cmd.do("set label_distance_digits, ${1:2};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/hideSelection: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: hideSelection 4 | # name: Turn off magenta squares on current selection. 5 | # group: Selection 6 | # key: hideSelection 7 | # -- 8 | cmd.do("indicate none") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/labelSS: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: labelSS 4 | # name: Label SS. 5 | # group: Labels 6 | # key: labelSS 7 | # -- 8 | cmd.do("alter ${1:chain A}, ss=\"${2:helix}\";") 9 | cmd.do("label (%2),\"%3\";") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/selectResi: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectResi 4 | # name: Select residues by a range of numbers. 5 | # group: Selection 6 | # key: selectResi 7 | # -- 8 | cmd.do("select ${!:se}; resi ${2: 1:100};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectResidues: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectResidues 4 | # name: Select residues by name. 5 | # group: Selection 6 | # key: selectResidues 7 | # -- 8 | cmd.do("select aromatic, resn phe+tyr+trp;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/fetchFoFc: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fetchFoFc 4 | # name: Fetch fofc map from the PDB. 5 | # group: FileIO 6 | # key: fetchFoFc 7 | # -- 8 | cmd.do("fetch ${1:3nd4}, ${1:3nd4}_fofc, type=fofc, async=0;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/labelCAs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: labelCAs 4 | # name: Label the CA atoms with the Ala333 style format. 5 | # group: Labels 6 | # key: labelCAs 7 | # -- 8 | cmd.do("label name CA,\"%s%s\" % (resn,resi);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/doubleBond: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: doubleBond 4 | # name: Valence bond. 5 | # group: MolecularRepresentation 6 | # key: doubleBond 7 | # -- 8 | cmd.do("set valence, 1; ") 9 | cmd.do("set valence_mode, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/fetchCIF: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fetchCIF 4 | # name: Fetch the atomic coordinates as a cif file from the PDB. 5 | # group: FileIO 6 | # key: fetchCIF 7 | # -- 8 | cmd.do("fetch ${1:3nd4}, type=cif, async=0;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/labelWatersW: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: labelWatersW 4 | # name: Label waters with W and their reisude number. 5 | # group: Labels 6 | # key: labelWatersW 7 | # -- 8 | cmd.do("label resn HOH ,\"W%s\" % (resi);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/rotate: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rotate 4 | # name: Rotate a selection about and axis by a given angle. 5 | # group: ChangeOrientation 6 | # key: rotate 7 | # -- 8 | cmd.do("rotate ${1:x}, ${2:45}, ${3:pept};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/aobw: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: AOBW 4 | # name: Run the AOBW function from the pymolshortcuts.py file to generate photorealistic effect in grayscale. 5 | # group: Jupyter 6 | # key: AOBW 7 | # -- 8 | cmd.do("AOBW") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/fetchPath: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fetchPath 4 | # name: Set path for location to save fetched pdb files. 5 | # group: Pymolrc 6 | # key: fetchPath 7 | # -- 8 | cmd.do("set fetch_path, ${1:/Users/blaine/pdbFiles};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/findHbonds: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: findHbonds 4 | # name: Find H-bonds around a residue. 5 | # group: Print 6 | # key: findHbonds 7 | # -- 8 | cmd.do("remove element h; distance hbonds, all, all, 3.2, mode=2;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/helpDocs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: helpDocs 4 | # name: Return the docstring for the help submodule. This command is more concise: help help. 5 | # group: Help 6 | # key: helpDocs 7 | # -- 8 | cmd.do("help(help)") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printAtomNames: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printAtomNames 4 | # name: Print the atom names of a residue. 5 | # group: Programming 6 | # key: printAtomNames 7 | # -- 8 | cmd.do("iterate (resi ${1:101}), print(name);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printBs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printBs 4 | # name: Print the B-factors of a residue. 5 | # group: Print 6 | # key: printBs 7 | # -- 8 | cmd.do("remove element h; iterate resi ${1: 1:13}, print(resi, name,b);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/cav: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cav 4 | # name: Run the cav function from the pymolshortcuts.py file to show buried cavities and pockets as molecular surfaces. 5 | # group: Jupyter 6 | # key: cav 7 | # -- 8 | cmd.do("cav") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/extractPartObj: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: extractPartObj 4 | # name: Create a new object from part of an existing object. 5 | # group: Selection 6 | # key: extractPartObj 7 | # -- 8 | cmd.do("extract new_obj, chain A;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/renumResi: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: renumResi 4 | # name: Add or substract a residue number offset. 5 | # group: Programming 6 | # key: renumResi 7 | # -- 8 | cmd.do("alter ${1:3fa0}, resi=str(int(resi)+${2:100});sort;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/setpath: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: setpath 4 | # name: Set additional path for PyMOL to search on startup. 5 | # group: Pymolrc 6 | # key: setpath 7 | # -- 8 | os.environ["PATH"] += os.pathsep +${1: "~/ATSAS-3.0.3-1/bin"}; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/aod: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: AOD 4 | # name: Run the AOD function from the pymolshortcuts.py file to generate photorealistic effect with carbons colored black. 5 | # group: Jupyter 6 | # key: AOD 7 | # -- 8 | cmd.do("AOD") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/cmddocs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cmddocs 4 | # name: Print in the command history window the docstrings of all of the functions in the cmd module. 5 | # group: Help 6 | # key: cmddocs 7 | # -- 8 | [help(i) for i in dir(cmd)]; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/labelWatersHOH: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: labelWatersHOH 4 | # name: Label waters with HOH and their residue number. 5 | # group: Labels 6 | # key: labelWatersHOH 7 | # -- 8 | cmd.do("label resn HOH ,\"%s%s\" % (resn,resi);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printBfactors: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printBfactors 4 | # name: Print the bfactors of a residue. 5 | # group: Programming 6 | # key: printBfactors 7 | # -- 8 | cmd.do("iterate (resi ${1:101}), print(name + \" %.2f\" % b);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/renameChain: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: renameChain 4 | # name: Rename a chain. 5 | # group: Programming 6 | # key: renameChain 7 | # -- 8 | cmd.do("alter ${1:3fa0} and chain ${2:A}, chain=${3:\"C\"};") 9 | cmd.do("sort;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/renumAtoms: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: renumAtoms 4 | # name: Add or substract a atom number offset. 5 | # group: Programming 6 | # key: renumAtoms 7 | # -- 8 | cmd.do("alter {$1:3fa0}, ID=ID+${2:100};") 9 | cmd.do("sort;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/rmd: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rmd 4 | # name: Remove all measurement objects in the interal GUI. 5 | # group: Jupyter 6 | # key: rmd 7 | # -- 8 | cmd.do("delete measure*") 9 | cmd.do("delete m*_*") 10 | cmd.do("delete dist*") 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/stateOne: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: stateOne 4 | # name: Select state 1 from a model with multiple states. 5 | # group: MolecularRepresentation 6 | # key: stateOne 7 | # -- 8 | cmd.create("newobject", "oldobject", "1", "1"); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/github: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: github 4 | # name: Print url of README.md file of the pymolsnips repository. 5 | # group: Help 6 | # key: github 7 | # -- 8 | cmd.do("https://github.com/MooersLab/pymolsnips/blob/master/README.md") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/pymoldocs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: pymoldocs 4 | # name: Return to the command history window the docstrings for all of the functions in a module. 5 | # group: Help 6 | # key: pymoldocs 7 | # -- 8 | [help(i) for i in dir(pymol)]; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/stereokb: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: stereokb 4 | # name: Set keyboard shortcut by mapping F1 to stereo. 5 | # group: Stereo 6 | # key: stereokb 7 | # -- 8 | cmd.set_key("F1",lambda:cmd.stereo({"on":0,"off":1}[cmd.get("stereo")])); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printBspartB: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printBspartB 4 | # name: Print B factors of part B of a residue. 5 | # group: Print 6 | # key: printBspartB 7 | # -- 8 | cmd.do("iterate resi ${1:38} and altloc ${2:B}, print resi, name, alt, b;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/pymoldocspy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: pymoldocspy 4 | # name: Return to the command history window the docstrings for all of the functions in a module. 5 | # group: Help 6 | # key: pymoldocspy 7 | # -- 8 | [help(i) for i in dir(pymol)]; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/internalGUImode2: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: internalGUImode2 4 | # name: Make the background of the internal gui transparent to expand viewport. 5 | # group: Workshop 6 | # key: internalGUImode2 7 | # -- 8 | cmd.do("internal_gui_mode=2;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/solventRadius: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: solventRadius 4 | # name: Set radius of ball used to make solvent accessible surface. 5 | # group: MolecularRepresentation 6 | # key: solventRadius 7 | # -- 8 | cmd.do("set solvent_radius, ${1:1.55};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectAtomsAround: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectAtomsAround 4 | # name: Select atoms within a radius around a ligand. 5 | # group: Selection 6 | # key: selectAtomsAround 7 | # -- 8 | cmd.do("select ${1:nearby}, resn ${2:drug} around ${3:5};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/sigdihedral: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sigdihedral 4 | # name: Set dihedral labels to display 2 decimals places to the right of the decimal point. 5 | # group: Labels 6 | # key: sigdihedral 7 | # -- 8 | cmd.do("set label_dihedral_digits, ${1:2};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/stereoRay: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: stereoRay 4 | # name: Stereo ray. 5 | # group: Stereo 6 | # key: stereoRay 7 | # -- 8 | cmd.do("stereo; ") 9 | cmd.do("set ray_shadow, off;") 10 | cmd.do("ray ${1:2400,1200};") 11 | cmd.do("png ${2:aaa}.png;") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/printAtomNumbers: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printAtomNumbers 4 | # name: Print the atom name and number of a residue. 5 | # group: Programming 6 | # key: printAtomNumbers 7 | # -- 8 | cmd.do("iterate (resi ${1:1}), print(name + \" %i${1:5}\" % ID);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/internalGUIwidth: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: internalGUIwidth 4 | # name: Set the width of the internal gui. Set to 0 to make the internal gui vanish. 5 | # group: Workshop 6 | # key: internalGUIwidth 7 | # -- 8 | cmd.do("set internal_gui_width=${1:0};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/labelMainChain: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: labelMainChain 4 | # name: Label the main chain atoms with the following: resn,resi,atom name. 5 | # group: Labels 6 | # key: labelMainChain 7 | # -- 8 | cmd.do("label name n+c+o+ca,\"%s%s%s\" % (resn,resi,name);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printVDWradii: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printVDWradii 4 | # name: Print the van der Waals radii of the atoms in of a residue. 5 | # group: Programming 6 | # key: printVDWradii 7 | # -- 8 | cmd.do("iterate (resi ${1:101}), print(name + \" %.2f\" % vdw);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/synch: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: synch 4 | # name: Wait until all current commands have been executed. A timeout ensures that that command eventually returns. 5 | # group: Programming 6 | # key: synch 7 | # -- 8 | cmd.sync(timeout=${1:1.0},poll=${2:0.05}); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/PE25: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: PE25 4 | # name: Run the PE25 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.25 of the van der Waals surface. 5 | # group: Jupyter 6 | # key: PE25 7 | # -- 8 | cmd.do("PE25") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/PE33: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: PE33 4 | # name: Run the PE33 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.33 of the van der Waals surface. 5 | # group: Jupyter 6 | # key: PE33 7 | # -- 8 | cmd.do("PE33") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/PE50: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: PE50 4 | # name: Run the PE50 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.50 of the van der Waals surface. 5 | # group: Jupyter 6 | # key: PE50 7 | # -- 8 | cmd.do("PE50") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/PE66: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: PE66 4 | # name: Run the PE66 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.66 of the van der Waals surface. 5 | # group: Jupyter 6 | # key: PE66 7 | # -- 8 | cmd.do("PE66") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/PE75: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: PE75 4 | # name: Run the PE75 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.75 of the van der Waals surface. 5 | # group: Jupyter 6 | # key: PE75 7 | # -- 8 | cmd.do("PE75") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/PE85: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: PE85 4 | # name: Run the PE85 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.85 of the van der Waals surface. 5 | # group: Jupyter 6 | # key: PE85 7 | # -- 8 | cmd.do("PE85") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/labelResnResi: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: labelResnResi 4 | # name: Label CA atom with single-letter residue name and residue number. 5 | # group: Labels 6 | # key: labelResnResi 7 | # -- 8 | cmd.do("label name ca, \"%s%s\" %(one_letter[${1:resn}],${2:resi});") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/listObjects: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: listObjects 4 | # name: Create a list of objects in the internal gui and print this list to the screen. 5 | # group: Objects 6 | # key: listObjects 7 | # -- 8 | cmd.do("objList = cmd.get_names(\"objects\");print(objList);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/selectResiduesAround: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectResiduesAround 4 | # name: Select residues within a radius around a ligand. 5 | # group: Selection 6 | # key: selectResiduesAround 7 | # -- 8 | cmd.do("select ${1:nearby}, br. resn ${2:drug} around ${3:5};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/volumeRamp: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: volumeRamp 4 | # name: Volume ramp. 5 | # group: ColorScheme 6 | # key: volumeRamp 7 | # -- 8 | 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,]) 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/PE125: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: PE125 4 | # name: Run the PE125 function from the pymolshortcuts.py file to show the pearl effect with the inner sphere scaled by 0.125 of the van der Waals surface. 5 | # group: Jupyter 6 | # key: PE125 7 | # -- 8 | cmd.do("PE125") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/ringMode: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: ringMode 4 | # name: Set the ring mode to a value between 0 and 6 in cartoons of nucleic acids. 5 | # group: MolecularRepresentation 6 | # key: ringMode 7 | # -- 8 | cmd.do("show cartoon, ${1:rna}; set cartoon_ring_mode, ${2:3};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/setcolor: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: setcolor 4 | # name: Set color name to a RGB code. 5 | # group: MolecularRepresentation 6 | # key: setcolor 7 | # -- 8 | cmd.do("set_color ${1:bark}, [${2:0.1, ${3:0.1}, ${4:0.1}];") 9 | cmd.do("color ${1:bark}, ${5:protein};") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sigDigits: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sigDigits 4 | # name: Set number of decimals places to show in distance labels. 5 | # group: Pymolrc 6 | # key: sigDigits 7 | # -- 8 | cmd.do("set label_distance_digits, ${1:2};") 9 | cmd.do("set label_angle_digits, ${2:2};") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/colorh1: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: colorh1 4 | # name: Run the colorh1 function from the pymolshortcuts.py file to color protein molecules according to the Eisenberg hydrophobicity scale, scheme 1. 5 | # group: Jupyter 6 | # key: colorh1 7 | # -- 8 | cmd.do("colorh1") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/colorh2: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: colorh2 4 | # name: Run the colorh2 function from the pymolshortcuts.py file to color protein molecules according to the Eisenberg hydrophobicity scale, scheme 2. 5 | # group: Jupyter 6 | # key: colorh2 7 | # -- 8 | cmd.do("colorh2") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/pseudolabel: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: pseudolabel 4 | # name: Position label with pseudoatom. 5 | # group: Labels 6 | # key: pseudolabel 7 | # -- 8 | cmd.do("pseudoatom ${1:forLabel};") 9 | cmd.do("label ${1:forLabel}, \"%0\";") 10 | cmd.do("set label_color, ${2:red};") 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/selectAllBut: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: selectAllBut 4 | # name: Select all nitrogen atom in a selelction except from lysine. 5 | # group: Selection 6 | # key: selectAllBut 7 | # -- 8 | cmd.do("select ${1:select1}, elem ${2:N} and chain ${3:A} and not resn ${4:LYS};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/timcolor: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: timcolor 4 | # name: Run the timcolor function from the pymolshortcuts.py file to color atoms accordings to Tim Mather's biophysical coloring scheme for proteins. 5 | # group: Jupyter 6 | # key: timcolor 7 | # -- 8 | cmd.do("timcolor") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/aodbw: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: AODBW 4 | # name: Run the AODBW function from the pymolshortcuts.py file to generate photorealistic effect with carbons colored black and all other atoms colored in grayscale. 5 | # group: Jupyter 6 | # key: AODBW 7 | # -- 8 | cmd.do("AODBW") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/discreteCartoonColoring: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: discreteCartoonColoring 4 | # name: Turn on discrete colors between secondary structure elements. 5 | # group: MolecularRepresentation 6 | # key: discreteCartoonColoring 7 | # -- 8 | cmd.do("set cartoon_discrete_colors, on;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/numResiProtein: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: numResiProtein 4 | # name: Print the number of residues in a protein. 5 | # group: Print 6 | # key: numResiProtein 7 | # -- 8 | sel = "polymer.protein"; print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom]))); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printBs2digits: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printBs2digits 4 | # name: Print B--factors for a residue with the B-factors rounded off to two decimal places. 5 | # group: Print 6 | # key: printBs2digits 7 | # -- 8 | cmd.do("iterate (resi ${1:133}), print(name + \" %.2f\" % b);") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/sdaepy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sdaepy 4 | # name: Save dae flle with timestamp. 5 | # group: FileIO 6 | # key: sdaepy 7 | # -- 8 | import datetime; 9 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 10 | s = str(DT); 11 | cmd.save(stemName+s+".dae"); 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/setLigandValenceOn: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: setLigandValenceOn 4 | # name: Display the bond valence of ligands only. 5 | # group: MolecularRepresentation 6 | # key: setLigandValenceOn 7 | # -- 8 | cmd.do("set valence, on, resn ${1:RZS}; set valence, off, not resn ${2:RZS};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/cribbon: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cribbon 4 | # name: Color ribbon H red, strand yellow, loop green. 5 | # group: ColorScheme 6 | # key: cribbon 7 | # -- 8 | cmd.do("as cartoon;") 9 | cmd.do("color red, ss H;") 10 | cmd.do("color yellow,ss S;") 11 | cmd.do("color green, ss L+;") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/duplicateObject: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: duplicateObject 4 | # name: Duplicate object. Create an object with the first argument using the selection, which is the second argument. 5 | # group: Selection 6 | # key: duplicateObject 7 | # -- 8 | cmd.do("create ${1:t4l}, ${2:1lw9};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/sidehChainHelper: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sidehChainHelper 4 | # name: In cartoons, hide the backbone atoms of selected residues when showing then as sticks. 5 | # group: MolecularRepresentation 6 | # key: sidehChainHelper 7 | # -- 8 | cmd.do("set cartoon_side_chain_helper, on;") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/fastapy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fastapy 4 | # name: Python version of the command to print the sequence from a PDB file in the fasta format. 5 | # group: Print 6 | # key: fastapy 7 | # -- 8 | # Get the sequences of all molecular objects.; 9 | print(cmd.get_fastastr("${1:all}")); 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/writeCommandReference2HTML: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: writeCommandReference2HTML 4 | # name: Write the command reference to html file in the present working directory. 5 | # group: Help 6 | # key: writeCommandReference2HTML 7 | # -- 8 | cmd.write_html_ref("pymol-command-ref.html"); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/loadAmberTrajs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: loadAmberTrajs 4 | # name: The amber trajectories have to be loaded into the same object. 5 | # group: Trajectories 6 | # key: loadAmberTrajs 7 | # -- 8 | cmd.do("load ${1:file}.top, ${2:protein};") 9 | cmd.do("load ${1:file}.rst, ${2:protein};") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/numResiNucleic: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: numResiNucleic 4 | # name: Print the number of residues in a nulceic acid (all chains). 5 | # group: Print 6 | # key: numResiNucleic 7 | # -- 8 | sel = "polymer.nucleic"; 9 | [print(len(set([(i.resi, i.resn) for i in cmd.get_model(sel).atom])))]; 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/presetDocs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: presetDocs 4 | # name: Return the docstring for the preset submodule. The command help preset fails to return anything. The command help(pymol.preset) has the same effect as help(preset). 5 | # group: Help 6 | # key: presetDocs 7 | # -- 8 | help(preset) 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/stereoDraw: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: stereoDraw 4 | # name: Stereo draw. 5 | # group: Stereo 6 | # key: stereoDraw 7 | # -- 8 | cmd.do("stereo walleye; ") 9 | cmd.do("set ray_shadow, off; ") 10 | cmd.do("#draw 3200,2000;") 11 | cmd.do("draw ${1:1600,1000}; ") 12 | cmd.do("png ${2:aaa}.png;") 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/centerpi: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: centerpi 4 | # name: Center pi. Edit the atoms selected for positioning the pseudoatom. 5 | # group: Labels 6 | # key: centerpi 7 | # -- 8 | cmd.do("pseudoatom pi_cent,/${1:3nd3}/${2:A}/${3:U`15}/cg+cz;") 9 | cmd.do("dist pi_cent////ps1, b/${4:U`15}/${5:aaa};") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/getCoordinatespy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: getCoordinatespy 4 | # name: Python version of getCoordinates snippets. Note that the python2 print statement stills works in pml scripts. 5 | # group: Print 6 | # key: getCoordinatespy 7 | # -- 8 | print(cmd.get_atom_coords(${1:\\"/4PCO//B/G`8/OP2\\"})); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printPath: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printPath 4 | # name: Print the path to the currently used PyMOL binary. 5 | # group: FileIO 6 | # key: printPath 7 | # -- 8 | 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}; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/spngpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: spngpy 4 | # name: Save png flle with timestamp. 5 | # group: FileIO 6 | # key: spngpy 7 | # -- 8 | import datetime; 9 | from pymol import cmd; 10 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 11 | s = str(DT); 12 | cmd.save(stemName+s+".png"); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/displayFonts: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: displayFonts 4 | # name: Print to the screen as labels the 21 font ids in their corresponding fonts in a grid. Each label is an object and appears in the internal gui. You can turn on and off the display of specific fonts. 5 | # group: Labels 6 | # key: displayFonts 7 | # -- 8 | $0 9 | -------------------------------------------------------------------------------- /python-mode/listSettings2: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: listSettings2 4 | # name: Print to the screen the settings and their current parameter values. 5 | # group: Settings 6 | # key: listSettings2 7 | # -- 8 | list = setting.get_name_list();[print("%s => %s" % (name, setting.get_setting_text(name))) for name in list]; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/hbonddash: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: hbonddash 4 | # name: Set up H-bond dashes. 5 | # group: H-bonds 6 | # key: hbonddash 7 | # -- 8 | cmd.do("hide everything, hydrogens;") 9 | cmd.do("hide labels;") 10 | cmd.do("set dash_color, black; ") 11 | cmd.do("set dash_gap, 0.4;") 12 | cmd.do("set dash_radius, 0.08;") 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/printCoordinates: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printCoordinates 4 | # name: Print the coordinates of the atoms in a residue. 5 | # group: Programming 6 | # key: printCoordinates 7 | # -- 8 | stored.coords = []; 9 | iterate_state 1, (resi ${1:101}), stored.coords.append([x,y,z]); 10 | [print(i) for i in stored.coords]; 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/saxsEnvelope: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: saxsEnvelope 4 | # name: Display SAXS envelope. Edit to enter the name of the bead model object. 5 | # group: MolecularRepresentation 6 | # key: saxsEnvelope 7 | # -- 8 | cmd.do("alter ${1:refine_A_Ave_SM_015_0_370-374-0r}, vdw=3.0;") 9 | cmd.do("set solvent_radius = 3.0;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/ellipcol: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: ellipcol 4 | # name: Set color of thernal ellipsoids. The PDB must have anisotopic temperature factors. See https://pymolwiki.org/index.php/Color_Values for the PyMOL colors. 5 | # group: MolecularRepresentation 6 | # key: ellipcol 7 | # -- 8 | cmd.do("set ellipsoid_color, ${1:red};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/fetch2FoFcIsomesh: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fetch2FoFcIsomesh 4 | # name: Fetch 2FoFc map as an isomesh. 5 | # group: ElectronDensity 6 | # key: fetch2FoFcIsomesh 7 | # -- 8 | cmd.do("fetch ${1:3nd4}, ${1:3nd4}_2fofc, type=2fofc, async=0;") 9 | cmd.do("isomesh 2fofcmap, ${1:3nd4}_2fofc, 1, ${1:3nd4}, carve = 1.8;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/numResiNucleicChainA: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: numResiNucleicChainA 4 | # name: Print the number of residues in a nulceic acid chain. 5 | # group: Print 6 | # key: numResiNucleicChainA 7 | # -- 8 | sel = "${1:chain A} and polymer.nucleic"; 9 | [print(len(set([(i.resi, i.resn) for i in cmd.get_model(sel).atom])))]; 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/numResiProteinChainA: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: numResiProteinChainA 4 | # name: Print the number of residues in chain A of a protein. 5 | # group: Print 6 | # key: numResiProteinChainA 7 | # -- 8 | sel = "${1:chain A} and polymer.protein"; print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom]))); 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/salnpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: salnpy 4 | # name: Save an aln flle with a timestamp. Python version. 5 | # group: FileIO 6 | # key: salnpy 7 | # -- 8 | import datetime; 9 | from pymol import cmd; 10 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 11 | s = str(DT); 12 | cmd.save(stemName+s+".aln"); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/bu: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: bu 4 | # name: Generate the biological unit using the quat.py script. Edit the path to the file quat.py. You may have to download it from the PyMOL Wiki page. 5 | # group: MolecularRepresentation 6 | # key: bu 7 | # -- 8 | cmd.do("run ~/${1:Scripts/PyMOLScripts}/quat.py;") 9 | cmd.do("quat;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/listSettings: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: listSettings 4 | # name: Print to the screen the settings and their current parameter values. This is the more compact version. 5 | # group: Settings 6 | # key: listSettings 7 | # -- 8 | [print("%s => %s" % (name, setting.get_setting_text(name))) for name in setting.get_name_list()]; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/sccp4py: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sccp4py 4 | # name: Save electron density map flle with timestamp. 5 | # group: FileIO 6 | # key: sccp4py 7 | # -- 8 | import datetime; 9 | from pymol import cmd; 10 | DT =datetime.datetime.now().strftime("yr%Ymo%mday%dhr%Hmin%M"); 11 | s = str(DT); 12 | cmd.save(stemName+s+".ccp4"); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/hidealtloc: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: hidealtloc 4 | # name: Hide the partially occupied atoms with the part b alternate locator. 5 | # group: AlternateLocators 6 | # key: hidealtloc 7 | # -- 8 | cmd.do("select altconf, alt ${1:b} # select B alternative locators;") 9 | cmd.do("hide everything, altconf # hide alt B locators;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/importIPythonDisplay: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: importIPythonDisplay 4 | # name: Imports for using IPython to display images loaded from disk in notebook cells. 5 | # group: Jupyter 6 | # key: importIPythonDisplay 7 | # -- 8 | from IPython.display import Image 9 | from IPython.core.display import HTML 10 | PATH = "/Users/blaine/" 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/sc144: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc144 4 | # name: Display all symmetry mates in in a 1 x 4 x 4 array. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc144 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 4, 4, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc211: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc211 4 | # name: Display all symmetry mates in two unit cell along a. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc211 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 2, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc414: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc414 4 | # name: Display all symmetry mates in a 4 x 1 x 4 array. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc414 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 4, 1, 4, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc113: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc113 4 | # name: Display all symmetry mates in three unit cels along c. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc113 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 1, 3, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc131: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc131 4 | # name: Display all symmetry mates in three unit cells along b. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc131 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 3, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc222: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc222 4 | # name: Run supercell script to generate three cells in all directions. This script was written by Thomas Holder. 5 | # group: UnitCellDisplay 6 | # key: sc222 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 2, 2, 2, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/bs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: bs 4 | # name: Ball and stick representation. 5 | # group: MolecularRepresentation 6 | # key: bs 7 | # -- 8 | cmd.do("show sticks;") 9 | cmd.do("set stick_radius, 0.12;") 10 | cmd.do("set stick_ball, on;") 11 | cmd.do("set stick_ball_ratio, 1.9;") 12 | cmd.do("show nb_spheres;") 13 | cmd.do("set nb_spheres_size=0.33;") 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/imports4PyMOLjupyter: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: imports4PyMOLjupyter 4 | # name: Imports needed for most uses of pymol in Jupyter. Combination of importPyMOL and importPythonDisplay. 5 | # group: Jupyter 6 | # key: imports4PyMOLjupyter 7 | # -- 8 | from pymol import cmd 9 | from IPython.display import Image 10 | from IPython.core.display import HTML 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/sc122: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc122 4 | # name: Display all symmetry mates in a 1 x 2 x 2 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc122 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 2, 2, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc133: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc133 4 | # name: Display all symmetry mates in 1 x 3 x 3 array of unit cell. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc133 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 3, 3, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc221: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc221 4 | # name: Display all symmetry mates in 2 x 2 x 1 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc221 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 2, 2, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc311: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc311 4 | # name: Display all symmetry mates three three unit cells along a. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc311 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 3, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc313: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc313 4 | # name: Display all symmetry mates in a 3 x 1 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc313 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 3, 1, 3, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc323: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc323 4 | # name: Display all symmetry mates in a 3 x 2 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc323 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc331: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc331 4 | # name: Display all symmetry mates in 3 x 3 x 1 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc331 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 3, 3, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc332: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc332 4 | # name: Display all symmetry mates in 3 x 3 x 2 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc332 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 3, 3, 2, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc333: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc333 4 | # name: Display all symmetry mates in 3 x 3 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc333 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 3, 3, 3, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc444: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc444 4 | # name: Display all symmetry mates in a 4 x 4 x4 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc444 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 4, 4, 4, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/importShortcuts: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: importShortcuts 4 | # name: Import for loading the functions in the pymolshortcuts.py file. These functions can be run inside cmd.do() without the trailing (). For example, cmd.do('rv'). 5 | # group: Jupyter 6 | # key: importShortcuts 7 | # -- 8 | cmd.do("run /Users/blaine/Scripts/PyMOLScripts/pymolshortcuts.py") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/printNameB4ResiX: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printNameB4ResiX 4 | # name: Print name and b-factor for a residue. 5 | # group: Print 6 | # key: printNameB4ResiX 7 | # -- 8 | Bfac_dict = { "Bfactors3" : [] }; 9 | cmd.iterate("(${1:resi 133})","Bfactors3.append((name, b))", space=Bfac_dict); 10 | [print("%s %.2f" % (i,j)) for i,j in Bfac_dict["Bfactors3"]; 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/sc112: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc112 4 | # name: Display all symmetry mates in two unit cells along the c axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc112 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 1, 2, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc114: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc114 4 | # name: Display all symmetry mates in four unit cells stacked long c-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc114 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 1, 4, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc121: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc121 4 | # name: Display all symmetry mates in two unit cells along the b axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc121 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 2, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc141: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc141 4 | # name: Display all symmetry mates in four unit cells stacked long b-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc141 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 4, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc212: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc212 4 | # name: Display all symmetry mates in a 2 x 1 x 2 arrays of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc212 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 2, 1, 2, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc233: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc233 4 | # name: Display all symmetry mates in a 2 x 3 x 3 array of unit cells. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc233 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 2, 3, 3, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc411: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc411 4 | # name: Display all symmetry mates in four unit cells stacked long a-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc411 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 4, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/sc441: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc441 4 | # name: Display all symmetry mates in four unit cells stacked long a-axis. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. 5 | # group: UnitCellDisplay 6 | # key: sc441 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 4, 4, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/waterTriple: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: waterTriple 4 | # name: Examples of a triple water pentagon. Zoom in on the selection. Edit by changing the residue number. 5 | # group: MolecularRepresentation 6 | # key: waterTriple 7 | # -- 8 | cmd.do("fetch ${1:lw9}, async=0; ") 9 | cmd.do("zoom resi ${2:313}; ") 10 | cmd.do("preset.technical(selection=\"all\", mode=1);") 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/sc111: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: sc111 4 | # name: Display all symmetry mates in one unit cell. Uses supercell.py in $HOME/Scripts/PyMOLscripts/. Change to your path to supercell.py. 5 | # group: UnitCellDisplay 6 | # key: sc111 7 | # -- 8 | cmd.do("run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;") 9 | cmd.do("supercell 1, 1, 1, , ${2:orange}, ${3:supercell1}, 1;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/hb: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: hb 4 | # name: Creates an object of all H-bonds found by PyMOL. 5 | # group: Jupyter 6 | # key: hb 7 | # -- 8 | cmd.distance("hbonds", "all", "all", "3.2", mode="2") 9 | cmd.set("dash_gap","0.4") 10 | cmd.set("dash_color","grey30") 11 | cmd.set("dash_width","1.5") 12 | cmd.set("dash_length",".25") 13 | print("Enter rmhb to remove the hbonds.") 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/pearl: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: pearl 4 | # name: The pearl effect is made with two spheres with the outer sphere being transparent. 5 | # group: MolecularRepresentation 6 | # key: pearl 7 | # -- 8 | cmd.do("create ${1:sodium2}, ${2:sodium1};") 9 | cmd.do("set sphere_transparency, 0.4, ${1:sodium2};") 10 | cmd.do("set sphere_scale, 1.05, ${1:sodium2};") 11 | cmd.do("ray;") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/oneBondThicknessColor: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: oneBondThicknessColor 4 | # name: To change stick color and radius for the bond between atom 2 and 3, use the set_bond command. 5 | # group: MolecularRepresentation 6 | # key: oneBondThicknessColor 7 | # -- 8 | cmd.do("set_bond stick_color, ${1:yellow}, index 2, index 3;") 9 | cmd.do("set_bond stick_radius, ${2:0.2}, index 2, index 3;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/allPairs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: allPairs 4 | # name: This is a two-fold nested list comprehension for any all-parwise operation on the currently loaded objects. Replace optAlginRNA with object from any other function that operations on a pair of structrures. 5 | # group: Objects 6 | # key: allPairs 7 | # -- 8 | [[${1:optAlignRNA}(x, y) for x in cmd.get_names()] for y in cmd.get_names()]; 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/cntfiles: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntfiles 4 | # name: Count number of files in current directory. 5 | # group: Jupyter 6 | # key: cntfiles 7 | # -- 8 | print("Count the files in the directory.") 9 | print("Usage: cntfiles.") 10 | # simple version for working with CWD 11 | print("Number of files in current working directory: ", len([name for name in os.listdir(".") if os.path.isfile(name)])) 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/cntpdbs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntpdbs 4 | # name: Count number of *.pdb files in current directory. 5 | # group: Jupyter 6 | # key: cntpdbs 7 | # -- 8 | print("Count the number of pdb files in the current directory.") 9 | print("Usage: cntpdb") 10 | myPath = os.getcwd() 11 | pdbCounter = len(glob.glob1(myPath,"*.pdb")) 12 | print("Number of pdb files in the current directory: ", pdbCounter) 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/molscriptRibbon: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: molscriptRibbon 4 | # name: Show cartoon in the style of Molscript ribbons. 5 | # group: MolecularRepresentation 6 | # key: molscriptRibbon 7 | # -- 8 | cmd.do("set cartoon_highlight_color, grey;") 9 | cmd.do("show cartoon;") 10 | cmd.do("set cartoon_flat_sheets, 0;") 11 | cmd.do("set cartoon_smooth_loops, 0;") 12 | cmd.do("set cartoon_fancy_helices, 1;") 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/spse: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: spse 4 | # name: Save pse flle with timestamp 5 | # group: FileIO 6 | # key: spse 7 | # -- 8 | cmd.do("python;") 9 | cmd.do("import datetime;") 10 | cmd.do("from pymol import cmd; ") 11 | cmd.do("DT =datetime.datetime.now().strftime(\"yr%Ymo%mday%dhr%Hmin%M\");") 12 | cmd.do("s = str(DT); ") 13 | cmd.do("cmd.save(stemName+s+\".pse\"); ") 14 | cmd.do("python end;") 15 | $0 16 | -------------------------------------------------------------------------------- /python-mode/ipymolStart: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: ipymolStart 4 | # name: Code to start the RPC server with ipymol. Start pymol in terminal with pymol -R; select pymol.python as the kernel in juptyer. You may have to create this kernel for the Python interpreter that is inside PyMOL. 5 | # group: Jupyter 6 | # key: ipymolStart 7 | # -- 8 | from ipymol import viewer as ipv; 9 | ipv.start() # Start PyMOL RPC server; 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/ms: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: ms 4 | # name: Measure surface area of the selection with the msms_pymol.py script. 5 | # group: Measurements 6 | # key: ms 7 | # -- 8 | cmd.do("fetch ${1:3nd3}, name=${1:3nd3}, type=pdb, async=0;") 9 | cmd.do("select ${2:temp}, ${1:3nd3} and chain ${4:A};") 10 | cmd.do("run ${5:/Users/blaine-mooers/Scripts/PyMOLScripts/msms_pymol.py};") 11 | cmd.do("calc_msms_area ${2:temp};") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/printResiResnNameB4ResiX: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printResiResnNameB4ResiX 4 | # name: Print resn, resi, atom name, and b-factor. 5 | # group: Print 6 | # key: printResiResnNameB4ResiX 7 | # -- 8 | Bfac_dict = { "Bfactors3" : [] }; 9 | cmd.iterate("(${1:resi 133})","Bfactors3.append((resn,resi,name, b))", space=Bfac_dict); 10 | [print("%s %s %s %.2f" % (i,j,k,l)) for i,j,k,l in Bfac_dict["Bfactors3"]] 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/drawHbonds: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: drawHbonds 4 | # name: Display H-bonds as dashes colored black. 5 | # group: H-bonds 6 | # key: drawHbonds 7 | # -- 8 | cmd.do("hide everything, hydrogens;") 9 | cmd.do("hide labels;") 10 | cmd.do("# set the color of the dashed lines representing the H-bond.;") 11 | cmd.do("set dash_color, ${1:black};") 12 | cmd.do("set dash_gap, 0.4;") 13 | cmd.do("set dash_radius, 0.08;") 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/cntlogs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntlogs 4 | # name: Count number of *.log files in current directory. 5 | # group: Jupyter 6 | # key: cntlogs 7 | # -- 8 | print("Count the number of log image files in current directory."); 9 | print("Usage: cntlogs"); 10 | myPath = os.getcwd(); 11 | logCounter = len(glob.glob1(myPath,"*.log")); 12 | print("Number of number of log image files in the current directory: ", logCounter); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/cntpmls: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntpmls 4 | # name: Count number of *.pml files in current directory. 5 | # group: Jupyter 6 | # key: cntpmls 7 | # -- 8 | print("Count the number of pml (Pymol macro language) files in current directory."); 9 | print("Usage: cntpmls"); 10 | myPath = os.getcwd(); 11 | pmlCounter = len(glob.glob1(myPath,"*.pml")); 12 | print("Number of pml files in the current directory: ", pmlCounter); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/cntpngs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntpngs 4 | # name: Count number of *.png files in current directory. 5 | # group: Jupyter 6 | # key: cntpngs 7 | # -- 8 | print("Count the number of png image files in current directory."); 9 | print("Usage: cntpngs"); 10 | myPath = os.getcwd(); 11 | pngCounter = len(glob.glob1(myPath,"*.png")); 12 | print("Number of number of png image files in the current directory: ", pngCounter); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/cntpses: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntpses 4 | # name: Count number of *.pse files in current directory. 5 | # group: Jupyter 6 | # key: cntpses 7 | # -- 8 | print("Count the number of *.pse (session) files in current directory."); 9 | print("Usage: cntpses"); 10 | myPath = os.getcwd(); 11 | pseCounter = len(glob.glob1(myPath,"*.pse")); 12 | print("Number of *.pse (session) files in the current directory: ", pseCounter); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/filledRing: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: filledRing 4 | # name: Filled rings in nucleic acids. 5 | # group: MolecularRepresentation 6 | # key: filledRing 7 | # -- 8 | cmd.do("show sticks;set cartoon_ring_mode, 3;") 9 | cmd.do("set cartoon_ring_finder, 1;") 10 | cmd.do("set cartoon_ladder_mode, 1;") 11 | cmd.do("set cartoon_nucleic_acid_mode, 4;") 12 | cmd.do("set cartoon_ring_transparency, 0.5;") 13 | cmd.do("as cartoon;") 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/importPyMOLandShortcuts: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: importPyMOLandShortcuts 4 | # name: Imports needed for most users of PyMOL in Jupyter. Combination of importPyMOL and importPythonDisplay. 5 | # group: Jupyter 6 | # key: importPyMOLandShortcuts 7 | # -- 8 | from pymol import cmd 9 | from IPython.display import Image 10 | PATH = "${1:/Users/blaine/}" 11 | cmd.do("run ${2:/Users/blaine/Scripts/PyMOLScripts/pymolshortcuts.py") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/cntmtzs: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntmtzs 4 | # name: Count number of *.mtz files in current directory. 5 | # group: Jupyter 6 | # key: cntmtzs 7 | # -- 8 | print("Count the number of mtz structure factor files in current directory."); 9 | print("Usage: cntmtzs"); 10 | myPath = os.getcwd(); 11 | mtzCounter = len(glob.glob1(myPath,"*.mtz")); 12 | print("Number of number of mtz structure factor files in the current directory: ", mtzCounter); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/loadAndAlignManyFiles2: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: loadAndAlignManyFiles2 4 | # name: To align all of the loaded RNA structures in all possible combinations by their C1' carbon atoms. Yes, this construct is a list comprehension inside a list comprehension! 5 | # group: Objects 6 | # key: loadAndAlignManyFiles2 7 | # -- 8 | cmd.do("run ${1:~/Scripts/}optAlignRNA.py;") 9 | cmd.do("[[optAlignRNA(x, y) for x in cmd.get_names()] for y in cmd.get_names()];") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/fetch2FoFcVolume: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fetch2FoFcVolume 4 | # name: Fetch 2FoFc map as a volume. 5 | # group: ElectronDensity 6 | # key: fetch2FoFcVolume 7 | # -- 8 | cmd.do("fetch ${1:3nd4}, type=cif, async=0;") 9 | cmd.do("fetch ${1:3nd4}, {1:3nd4}_2fofc, type=2fofc, async=0;") 10 | cmd.do("# Render and display a contour of this map as a volume around a selection called LongGlycan.;") 11 | cmd.do("volume 2fofcmap, ${1:3nd4}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/printResiResnNameB4ResiXNoH: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printResiResnNameB4ResiXNoH 4 | # name: Print name and b-factor for a residue or residue range (e.g. 81:120). The noH variant. 5 | # group: Print 6 | # key: printResiResnNameB4ResiXNoH 7 | # -- 8 | Bfac_dict = { "Bfactors3" : [] }; 9 | cmd.iterate("(${1:resi 133} and not elem H)","Bfactors3.append((resn,resi,name, b))", space=Bfac_dict); 10 | [print("%s %s %s %.2f" % (i,j,k,l))for i,j,k,l in Bfac_dict["Bfactors3"]]; 11 | $0 12 | -------------------------------------------------------------------------------- /python-mode/cblind: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cblind 4 | # name: Apply color blind friendly to ribbon diagrams. Edit the path to the Pymol-script-repo in your computer account. See PyMOL wiki for more information about the Pymol-script-reo. 5 | # group: ColorScheme 6 | # key: cblind 7 | # -- 8 | cmd.do("run ~/${1:Pymol-script-repo}/colorblindfriendly.py;") 9 | cmd.do("as cartoon;") 10 | cmd.do("color cb_red, ss H;") 11 | cmd.do("color cb_yellow,ss S;") 12 | cmd.do("color cb_green, ss L+;") 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/cntccp4emaps: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cntccp4emaps 4 | # name: Count number of *.ccp4 (electron density map) files in current directory. 5 | # group: Jupyter 6 | # key: cntccp4emaps 7 | # -- 8 | print("Count the number of ccp4 electron density files in current directory."); 9 | print("Usage: cntccp4s"); 10 | myPath = os.getcwd(); 11 | ccp4Counter = len(glob.glob1(myPath,"*.pse")); 12 | print("Number of number of ccp4 electron density files in the current directory: ", ccp4Counter); 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/distance: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: distance 4 | # name: H-bond distance between a H-bond donor and acceptor. Edit the name for the ditance, the selection criteria for atom 1, and the selection criteria for atom 2. 5 | # group: H-bonds 6 | # key: distance 7 | # -- 8 | cmd.do("# Edit the name for the ditance, the selection criteria for atom 1, and the selection criteria for atom 2.;") 9 | cmd.do("distance ${1:dist3}, ${2:/rcsb074137//B/IOD`605/I`B}, ${3:/rcsb074137//B/IOD`605/I`A};") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/dssrBlock2: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: dssrBlock2 4 | # name: DSSR block representation with fused blocks after loading the dssr_block.py script by Thomas Holder. The x3dna-dssr executable needs to be in the PATH. 5 | # group: NucleicAcids 6 | # key: dssrBlock2 7 | # -- 8 | cmd.do("reinitialize;") 9 | cmd.do("run /Users/blaine/.pymol/startup/dssr_block.py;") 10 | cmd.do("set cartoon_nucleic_acid_color, orange;") 11 | cmd.do("fetch 1ehz, async=0;") 12 | cmd.do("dssr_block block_file=wc") 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/his31asp70: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: his31asp70 4 | # name: Display the famous Asp70-His31 salt-bridge from T4 lysozyme that contributes3-5 kcal/mol to protein stability. 5 | # group: MolecularRepresentation 6 | # key: his31asp70 7 | # -- 8 | cmd.do("fetch ${1:1lw9}, async=0; ") 9 | cmd.do("zoom (${2:resi 31 or resi 70}); ") 10 | cmd.do("preset.technical(selection=\"all\"); ") 11 | cmd.do("bg_color ${3:gray70}; ") 12 | cmd.do("clip slab, 7,(${4:resi 31 or resi 70});") 13 | cmd.do("rock;") 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/drawLinks: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: drawLinks 4 | # name: Connect the alpha carbons of residue 1 with 10, 6 with 16, 7 with 17 and 8 with 18. Note that this example requires the draw_links.py [http://pldserver1.biochem.queensu.ca/~rlc/work/pymol/draw_links.py] by Robert Campbell. 5 | # group: MolecularRepresentation 6 | # key: drawLinks 7 | # -- 8 | 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};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/fetch2FoFcIsosurface: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fetch2FoFcIsosurface 4 | # name: Fetch 2FoFc map as an isosurface. Edit the PDB-ID code. Use lowercase letter for the fifth character to select a single chain. Render and display a contour of this map as a chicken wire representation. 5 | # group: ElectronDensity 6 | # key: fetch2FoFcIsosurface 7 | # -- 8 | cmd.do("fetch ${1:3nd4}, ${1:3nd4}_2fofc, type=2fofc, async=0;") 9 | cmd.do("isosurface 2fofcmap, ${1:3nd4}_2fofc, 1, ${1:3nd4}, carve = 1.8;") 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/oneLetter: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: oneLetter 4 | # name: Switch from three letter code to one-letter code for amino acids. 5 | # group: Labels 6 | # key: oneLetter 7 | # -- 8 | 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\"}%") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/kernel: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: kernel 4 | # name: A kernel.json file for runnig PyMOL python interpreter in the Jupyter notebook. This code should reside in a folder named pymol.python in the ~/Library/Jupyter/kernels. 5 | # group: Jupyter 6 | # key: kernel 7 | # -- 8 | { 9 | "argv": [ 10 | "/Applications/PyMOL.app/Contents/bin/python", 11 | "-m", 12 | "ipykernel_launcher", 13 | "-f", 14 | "{connection_file}" 15 | ], 16 | "display_name": "pymol.python", 17 | "language": "python" 18 | } 19 | $0 20 | -------------------------------------------------------------------------------- /python-mode/cblindCartoon: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cblindCartoon 4 | # name: Color cartoon with colorblind friendly colors. Requires that the pymolshortcuts.py file is loaded. This has been applied to PDB-ID 7JU6. The protein is human RET kinase, and the drug is selpercatinib, a FDA approved drug for treating several cancers. 5 | # group: FileIO 6 | # key: cblindCartoon 7 | # -- 8 | cmd.do("CB;") 9 | cmd.do("color cb_lightblue, ss h;") 10 | cmd.do("color cb_vermillion, ss s;") 11 | cmd.do("color lightorange, ss l+\"\";") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/dssrBlock3: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: dssrBlock3 4 | # name: DSSR block representation for a multi-state example after loading the dssr_block.py script by Thomas Holder. The x3dna-dssr executable needs to be in the PATH. Edit the path to Thomas Holder's block script. 5 | # group: NucleicAcids 6 | # key: dssrBlock3 7 | # -- 8 | cmd.do("reinitialize;") 9 | cmd.do("run ${1:\"/Users/blaine/.pymol/startup/dssr_block.py\"};") 10 | cmd.do("fetch ${2:2n2d}, async=0;") 11 | cmd.do("dssr_block ${2:2n2d}, 0;") 12 | cmd.do("set all_states;") 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/dssrBlock4: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: dssrBlock4 4 | # name: DSSR block representation with custom coloring after loading the dssr_block.py script by Thomas Holder. The x3dna-dssr executable needs to be in the PATH. 5 | # group: NucleicAcids 6 | # key: dssrBlock4 7 | # -- 8 | cmd.do("reinitialize;") 9 | cmd.do("${1:run /Users/blaine/.pymol/startup/dssr_block.py};") 10 | cmd.do("fetch ${2:1msy}, async=0;") 11 | cmd.do("set cartoon_nucleic_acid_color, ${3:orange};") 12 | cmd.do("dssr_block block_color=N red | minor 0.9 | major yellow;") 13 | $0 14 | -------------------------------------------------------------------------------- /python-mode/displayFontspy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: displayFontspy 4 | # name: Print to the screen as labels the 21 font ids in their corresponding fonts in a grid. Each label is an object and appears in the internal gui. You can turn on and off the display of specific fonts. 5 | # group: Labels 6 | # key: displayFontspy 7 | # -- 8 | for i in range(1,21): 9 | name = "label%d" % i; 10 | cmd.pseudoatom(name, label="label font id %d" % i, pos=(0,0,0)); 11 | cmd.set("label_font_id", i, name); 12 | cmd.set("label_size", 50); 13 | cmd.set("grid_mode"); 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/nucleicAcidCartoon: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nucleicAcidCartoon 4 | # name: Settings for nucliec acid cartoon. The dark blue used for electron density maps is called `density`. The cartoon_ladder_radius should be renamed the cartoon_rung_radius. The dimensions are in Angstroms. 5 | # group: NucleicAcids 6 | # key: nucleicAcidCartoon 7 | # -- 8 | cmd.do("set cartoon_ladder_radius, ${2:0.2};") 9 | cmd.do("set cartoon_nucleic_acid_color, ${3:red};") 10 | cmd.do("# The cartoon ring modes range from 0 to 4.;") 11 | cmd.do("set cartoon_ring_mode, ${4:2};") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/aveB4resiXpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: aveB4resiXpy 4 | # name: AveBResiX, prints the residue number and the average bfactor. Uses reduce and lambda, builtin Python functional porgramming functions. Note that you need to convert the length of the list of Bfactors from an integer. 5 | # group: Print 6 | # key: aveB4resiXpy 7 | # -- 8 | for i in range(1,21): 9 | name = "label%d" % i; 10 | cmd.pseudoatom(name, label="label font id %d" % i, pos=(0,0,0)); 11 | cmd.set("label_font_id", i, name); 12 | cmd.set("label_size", 50); 13 | cmd.set("grid_mode"); 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/printNamesCoordinates: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printNamesCoordinates 4 | # name: Print the atom names as tuples and coordinates of the atoms in a residue as a list. 5 | # group: Programming 6 | # key: printNamesCoordinates 7 | # -- 8 | cmd.do("stored.coords = []; iterate_state 1, (resi ${1:101}), stored.coords.append([x,y,z]); ") 9 | cmd.do("stored.names = []; iterate_state 1, (resi ${1:101}), stored.names.append([name]);") 10 | cmd.do("stored.names3 = [tuple(i) for i in stored.names];") 11 | cmd.do("[print(i,j) for i,j in(zip(stored.names3, stored.coords)];") 12 | $0 13 | -------------------------------------------------------------------------------- /python-mode/symexp: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: symexp 4 | # name: The code expands the asymmetric unit. It like the generate symmetry mates command but it provides more control over the prefix name of the symmetry mates and the addition of unique segment identifiers for each symmetry mate. The usage: symexp prefix, object, (selection), cutoff, segidFlag. The cutoff is in Angstroms. The segidFlag set to 1 will add unique segids. For related functions, see SC***. 5 | # group: UnitCellDisplay 6 | # key: symexp 7 | # -- 8 | cmd.do("symexp ${1:symm}, ${2:3fa0}, (${2:3fa0}), ${3:20},${4:1};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/scaleRadiusColorPythonInsertpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: scaleRadiusColorPythonInsertpy 4 | # name: Python block insert for scaleRadiusColorpy. 5 | # group: MolecularRepresentation 6 | # key: scaleRadiusColorPythonInsertpy 7 | # -- 8 | # scale the b−values; 9 | M = max(stored.bb); 10 | scaledBB = map(lambda x: float (x/M), stored.bb); 11 | count = 0; 12 | # set the sphere radii independently; 13 | #[(cmd.set("sphere_scale", x ,"ID %s"%count); count = count + 1) for x in scaledBB] 14 | for x in scaledBB: 15 | cmd.set("sphere_scale", x ,"ID %s"%count) 16 | count = count + 1 17 | $0 18 | -------------------------------------------------------------------------------- /python-mode/brokenNucleicBackbone: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: brokenNucleicBackbone 4 | # name: Create bonds between phosphorous and O3* atoms in a low-resolution DNA structure that is 80 base pairs long. Edit the selections below, which are ranges of residue numbers and edit the molecular object name (5fur). 5 | # group: NucleicAcids 6 | # key: brokenNucleicBackbone 7 | # -- 8 | [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})]; 9 | [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})]; 10 | $0 11 | -------------------------------------------------------------------------------- /python-mode/cspheres: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: cspheres 4 | # name: Colored spheres. 5 | # group: MolecularRepresentation 6 | # key: cspheres 7 | # -- 8 | cmd.do("as spheres;") 9 | cmd.do("color gray30, chain ${1:A};") 10 | cmd.do("color white, chain ${2:B};") 11 | cmd.do("color green, name CL;") 12 | cmd.do("color brown, resn NAG;") 13 | cmd.do("color red, resi 381;") 14 | cmd.do("remove solvent;") 15 | cmd.do("set specular, 0;") 16 | cmd.do("set ray_trace_gain, 0;") 17 | cmd.do("set ray_trace_mode, 3;") 18 | cmd.do("bg_color white;") 19 | cmd.do("set ray_trace_color, black;") 20 | cmd.do("set depth_cue,0;") 21 | $0 22 | -------------------------------------------------------------------------------- /python-mode/averageB: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: averageB 4 | # name: Average the B-factors by using a regular list as opposed to a stored list in PyMOL. Edit the selection as needed. 5 | # group: Print 6 | # key: averageB 7 | # -- 8 | cmd.do("Bfactors = []; ") 9 | cmd.do("# >>> edit the selection below, which is a range of residue numbers here.;") 10 | cmd.do("iterate (resi ${1:133}), Bfactors.append(b);") 11 | cmd.do("print(\"Sum = \", \"%.2f\" % (sum(Bfactors)));") 12 | cmd.do("print(\"Number of atoms = \", len(Bfactors));") 13 | cmd.do("print( \"Average B =\" , \"%.2f\" % ( sum(Bfactors)/float(len(Bfactors))));") 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/printColorByAtomCodes: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: printColorByAtomCodes 4 | # name: Print the codes for color-by-atom (util.cba*) alternates. 5 | # group: ColorScheme 6 | # key: printColorByAtomCodes 7 | # -- 8 | 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") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/nucleicAcidColorbySequence: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nucleicAcidColorbySequence 4 | # name: This code colors the nucleotides by base seqence. It can be applied to any nucleic acid. 5 | # group: NucleicAcids 6 | # key: nucleicAcidColorbySequence 7 | # -- 8 | cmd.do("select rna_A, resn A;") 9 | cmd.do("select rna_C, resn C;") 10 | cmd.do("select rna_G, resn G;") 11 | cmd.do("select rna_U, resn U;") 12 | cmd.do("select dna_T, resn T;") 13 | cmd.do("color ${1:yellow}, rna_A;") 14 | cmd.do("color ${2:red}, rna_C; ") 15 | cmd.do("color ${3:gray40}, rna_G;") 16 | cmd.do("color ${4:palecyan}, rna_U;") 17 | cmd.do("color ${5:brown}, dna_T;") 18 | $0 19 | -------------------------------------------------------------------------------- /python-mode/unitCellEdgesColorBlack: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: unitCellEdgesColorBlack 4 | # name: Color unit cell edges black. The settings for controlling the unit cell color are hard to find. 5 | # group: UnitCellDisplay 6 | # key: unitCellEdgesColorBlack 7 | # -- 8 | cmd.do("# show the unit cell;") 9 | cmd.do("show cell;") 10 | cmd.do("color black, ${1:1lw9};") 11 | cmd.do("# color by atom with carbons colored green,") 12 | cmd.do("util.${2:cbag};") 13 | cmd.do("set cgo_line_width, 2.5;") 14 | cmd.do("# string filename, int width, int height, float dpi, int ray") 15 | cmd.do("png ${3:testCell3}.png, ${4:1600},${5:1600},${6:600},${7:0}") 16 | $0 17 | -------------------------------------------------------------------------------- /python-mode/rdkrpcProtein: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rdkrpcProtein 4 | # name: Demo of the use of the RPC server with a protein via rdkit. 5 | # group: Jupyter 6 | # key: rdkrpcProtein 7 | # -- 8 | from rdkit.Chem import PyMol; 9 | 10 | Usage=""""Start pymol from command line with -R flag. 11 | Select the pymol.python kernel in Jupyter notebook. """; 12 | 13 | s = PyMol.MolViewer(); 14 | du = s.server.do; 15 | 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});"); 16 | s.GetPNG(preDelay=3); 17 | du("png ${3:T4L600dpi}.png, dpi=600"); 18 | $0 19 | -------------------------------------------------------------------------------- /python-mode/savePNG: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: savePNG 4 | # name: Save a png file of current scene to the current directory. PyMOL writes out only png files. This file may need to be converted to a tiff file. See the png2tiff snippet for a bash script that converts all png files in a folder into tiff files. 1: png filename. 2: x-dimension in pixels. 3: y-dimension in pixels, 1600 x 1000 approximates the golden ratio. Usually want a square for multipanel figures..4: dots per inch. 5: ray tracing off, 0; ray tracing on, 1 should also consider image without ray tracing shadows. 5 | # group: FileIO 6 | # key: savePNG 7 | # -- 8 | cmd.do("png ${1:saveMe}.png, ${2:1920}, ${3:1920}, ${4:600}, ${5:1};") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/puttyCartoon: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: puttyCartoon 4 | # name: Create a putty cartoon. The command may be needed if the above setting does not work. This can happen if using the presets. The command below may be needed if the above setting does not work.This can happen if using the presets. The command below may be needed if the above setting does not work. This can happen if using the presets. 5 | # group: MolecularRepresentation 6 | # key: puttyCartoon 7 | # -- 8 | cmd.do("show cartoon;") 9 | cmd.do("cartoon putty;") 10 | cmd.do("set cartoon_smooth_loops, 0;") 11 | cmd.do("set cartoon_flat_sheets, 0;") 12 | cmd.do("set cartoon_smooth_loops,0;") 13 | cmd.do("## unset cartoon_smooth_loops;") 14 | $0 15 | -------------------------------------------------------------------------------- /python-mode/dssrBlock1: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: dssrBlock1 4 | # name: Combining DSSR block representation with regular PyMOL cartoons after loading the dssr_block.py script by Thomas Holder. 5 | # group: NucleicAcids 6 | # key: dssrBlock1 7 | # -- 8 | cmd.do("reinitialize;") 9 | cmd.do("run /Users/blaine/.pymol/startup/dssr_block.py;") 10 | cmd.do("fetch 1ehz, async=0;") 11 | cmd.do("as cartoon;") 12 | cmd.do("set cartoon_ladder_radius, 0.1;") 13 | cmd.do("set cartoon_ladder_color, gray;") 14 | cmd.do("set cartoon_nucleic_acid_mode, 1;") 15 | cmd.do("set cartoon_nucleic_acid_color, orange;") 16 | cmd.do("orient;turn z,30; translate [0,5,0]") 17 | cmd.do("dssr_block;") 18 | cmd.do("png ~/dssrBlock1.png 1600,1600") 19 | $0 20 | -------------------------------------------------------------------------------- /python-mode/nucleicAcidCartoonFilledRings: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nucleicAcidCartoonFilledRings 4 | # name: The code provides a cartoon of the loaded nucleic acid that has the ladder rungs replaced by filled rings that are colored by atom type. The code can be applied to any nucleic acid. It is derived from the FR shortuct in pymolshortcuts.py. 5 | # group: NucleicAcids 6 | # key: nucleicAcidCartoonFilledRings 7 | # -- 8 | cmd.do("bg_color white;") 9 | cmd.do("show sticks;") 10 | cmd.do("set cartoon_ring_mode, 3;") 11 | cmd.do("set cartoon_ring_finder, 1;") 12 | cmd.do("set cartoon_ladder_mode, 1;") 13 | cmd.do("set cartoon_nucleic_acid_mode, 4;") 14 | cmd.do("set cartoon_ring_transparency, 0.5;") 15 | cmd.do("as cartoon;") 16 | $0 17 | -------------------------------------------------------------------------------- /python-mode/saveSeppy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: saveSeppy 4 | # name: Saves multiple objects into multiple files using an optional prefix name. 5 | # group: Objects 6 | # key: saveSeppy 7 | # -- 8 | from pymol import cmd 9 | import glob 10 | import re 11 | 12 | def saveSep(prefix=""): 13 | """ 14 | save_sep 15 | 16 | saves multiple objects into multiple files using an optional prefix name. 17 | 18 | e.g. save_sep prefix 19 | """ 20 | obj_list = cmd.get_names("all") 21 | 22 | if obj_list: 23 | for i in range(len(obj_list)): 24 | obj_name = "%s%s.pdb" % (prefix, obj_list[i]) 25 | cmd.save(obj_name, obj_list[i]) 26 | print("Saving %s" % obj_name) 27 | else: 28 | print("No objects found") 29 | $0 30 | -------------------------------------------------------------------------------- /python-mode/rdkrpcChem: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rdkrpcChem 4 | # name: Demo of the use of the RPC server with a drug compound via the rdkit python module. 5 | # group: Jupyter 6 | # key: rdkrpcChem 7 | # -- 8 | import os; 9 | import rdkit; 10 | from rdkit import Chem; 11 | from rdkit.Chem import AllChem; 12 | from rdkit.Chem import PyMol; 13 | 14 | s = PyMOL.MolViewer(); 15 | mol = Chem.MolFromSmiles("${1:CCOCCn1c(C2CC[NH+](CCc3ccc(C(C)(C)C(=O)[O-])cc3)CC2)nc2ccccc21}"); 16 | mol = AllChem.AddHs(mol); 17 | AllChem.EmbedMolecule(mol); 18 | AllChem.MMFFOptimizeMolecule(mol); 19 | s.ShowMol(mol, name = "${2:bilastine}", showOnly = False); 20 | s.Zoom("${2:bilastine}"); 21 | s.SetDisplayStyle("${2:bilastine}", "sticks"); 22 | s.GetPNG(preDelay=5); 23 | $0 24 | -------------------------------------------------------------------------------- /python-mode/ao: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: ao 4 | # name: Apply the ambient occlussion effect to get the photorealistic effect. 5 | # group: MolecularRepresentation 6 | # key: ao 7 | # -- 8 | cmd.do("set_color oxygen, [1.0,0.4,0.4];") 9 | cmd.do("set_color nitrogen, [0.5,0.5,1.0];") 10 | cmd.do("remove solvent;") 11 | cmd.do("as spheres;") 12 | cmd.do("util.cbaw;") 13 | cmd.do("bg white;") 14 | cmd.do("set light_count,10;") 15 | cmd.do("set spec_count,1;") 16 | cmd.do("set shininess, 10;") 17 | cmd.do("set specular,0.25;") 18 | cmd.do("set ambient,0;") 19 | cmd.do("set direct,0;") 20 | cmd.do("set reflect,1.5;") 21 | cmd.do("set ray_shadow_decay_factor, 0.1;") 22 | cmd.do("set ray_shadow_decay_range, 2;") 23 | cmd.do("set depth_cue, 0;") 24 | cmd.do("ray;") 25 | $0 26 | -------------------------------------------------------------------------------- /python-mode/threeMapsVolume: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: threeMapsVolume 4 | # name: Three electron density as volumes. Make sure to rename map file so that the root filename differs from pdb root filename. 5 | # group: ElectronDensity 6 | # key: threeMapsVolume 7 | # -- 8 | cmd.do("load ${1:4dgr}.pdb;") 9 | cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;") 10 | cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;") 11 | cmd.do("select ${2:glycan}, ${3:resid 200 or (resid 469:477)};") 12 | cmd.do("volume ${4:mesh1}, 2fofc, 1.0, ${2:glycan};") 13 | cmd.do("color density, ${4:mesh1};") 14 | cmd.do("volume ${5:mesh2}, fofc, 3.0, ${2:glycan};") 15 | cmd.do("color green, ${5:mesh2};") 16 | cmd.do("volume ${6:mesh3}, fofc, -3.0, ${2:glycan};") 17 | cmd.do("color red, ${6:mesh3};") 18 | $0 19 | -------------------------------------------------------------------------------- /python-mode/fetchThreeMaps: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: fetchThreeMaps 4 | # name: Display three electron density maps as isomesh. 5 | # group: ElectronDensity 6 | # key: fetchThreeMaps 7 | # -- 8 | cmd.do("fetch ${1:4dgr}, type=pdb;") 9 | cmd.do("# Make sure to rename map file so that ;") 10 | cmd.do("# the root filename differs from pdb root filename;") 11 | cmd.do("fetch ${1:4dgr}, ${1:4dgr}_2fofc, type=2fofc;") 12 | cmd.do("fetch ${1:4dgr}, ${1:4dgr}_fofc, type=fofc;") 13 | cmd.do("select ${2:glycan}, ${3:resid 200 or resid 469:477};") 14 | cmd.do("isomesh ${4:mesh1}, 2fofc, 1.0, ${2:glycan};") 15 | cmd.do("color density, ${4:mesh1};") 16 | cmd.do("isomesh ${5:mesh2}, fofc, 3.0, ${2:glycan};") 17 | cmd.do("color green, ${5:mesh2};") 18 | cmd.do("isomesh ${6:mesh3}, fofc, -3.0, ${2:glycan};") 19 | cmd.do("color red, ${6:mesh3};") 20 | $0 21 | -------------------------------------------------------------------------------- /python-mode/threeMapsIsosurface: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: threeMapsIsosurface 4 | # name: Display three electron density maps as isosurfaces. 5 | # group: ElectronDensity 6 | # key: threeMapsIsosurface 7 | # -- 8 | cmd.do("load ${1:4dgr}.pdb;") 9 | cmd.do("# Make sure to rename map file so that ;") 10 | cmd.do("# the root filename differs from pdb root filename;") 11 | cmd.do("load ${1:4dgr}_2fofc.ccp4, 2fofc;") 12 | cmd.do("load ${1:4dgr}_fofc.ccp4, fofc;") 13 | cmd.do("select ${2:glycan}, ${3:resid 200 or (resid 469:477)};") 14 | cmd.do("isosurface ${4:mesh1}, 2fofc, 1.0, ${2:glycan};") 15 | cmd.do("color density, ${4:mesh1};") 16 | cmd.do("isosurface ${5:mesh2}, fofc, 3.0, ${2:glycan};") 17 | cmd.do("color green, ${5:mesh2};") 18 | cmd.do("isosurface ${6:mesh3}, fofc, -3.0, ${2:glycan};") 19 | cmd.do("color red, ${6:mesh3};") 20 | $0 21 | -------------------------------------------------------------------------------- /python-mode/ipymolProtein: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: ipymolProtein 4 | # name: Demo of the use of the RPC server with a protein via ipymol. Create a kernel for python interpreter from PyMOL inside Jupyter. See the kernel snippet for an example. See the README.md file on pymolsnips GItHub website or more details https://github.com/MooersLab/pymilsnips. Start pymol in terminal with pymol -R. Select pymol.python as kernel in Juptyer. The double parentheses are required when set_view is run this way.; 5 | # group: Jupyter 6 | # key: ipymolProtein 7 | # -- 8 | from ipymol import viewer as ipv; 9 | # Start PyMOL RPC server; 10 | ipv.start(); 11 | ipv.do("fetch ${1:1lw9}"); 12 | ipv.do("rv"); 13 | 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)); 14 | ipv.do("AOD"); 15 | ipv.png("${2:testipymolT4L}.png"); 16 | $0 17 | -------------------------------------------------------------------------------- /python-mode/grayscale: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: grayscale 4 | # name: Apply grayscale coloring using a grayscale version of the PyMOL colors for the elements. This is a Python function. It is invoked in a script file via grayscale(). There is a corresponding gscale shortcut in pymolshortcuts.py that is invoked in a pml script by entering gscale if the functions in pymolshortcuts.py have been loaded with the run pymolshortcuts.py command. 5 | # group: ColorScheme 6 | # key: grayscale 7 | # -- 8 | 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") 9 | $0 10 | -------------------------------------------------------------------------------- /python-mode/nucleicAcidBackboneTubesSticks: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nucleicAcidBackboneTubesSticks 4 | # name: This code shows the cartoon backbone tube as 65% transparent. It hides the rungs of the cartoon. It shows all of the non-H atoms are sticks. The motivation is to have the cartoon highlight the backbone without dominanting the scene. 5 | # group: NucleicAcids 6 | # key: nucleicAcidBackboneTubesSticks 7 | # -- 8 | cmd.do("set bg_rgb, white;") 9 | cmd.do("hide everything, all;") 10 | cmd.do("# Change to the name of your molecular object.;") 11 | cmd.do("show cartoon, ${1:3nd3};") 12 | cmd.do("set cartoon_sampling,1;") 13 | cmd.do("set cartoon_tube_radius, 0.5;") 14 | cmd.do("set cartoon_ladder_mode, 0;") 15 | cmd.do("# Set to 0.0 to turn off transparency;") 16 | cmd.do("set cartoon_transparency, ${2:0.65};") 17 | cmd.do("# The default strick radisu is 0.25. I think it is too thick.;") 18 | cmd.do("set stick_radius ${3:0.12};") 19 | cmd.do("show sticks;") 20 | cmd.do("hide sticks, element H;") 21 | $0 22 | -------------------------------------------------------------------------------- /python-mode/loadAndAlignManyFiles1: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: loadAndAlignManyFiles1 4 | # name: These are the instructions for loading and aligning multiple files. To save multiple models in a file to separate pdb files. 5 | # group: Objects 6 | # key: loadAndAlignManyFiles1 7 | # -- 8 | # Copyright (c) 2004 Robert L. Campbell 9 | # 10 | # Modified for use with Python3. 11 | # Jan. 29, 2020 12 | # Blaine Mooers, PhD 13 | # Univ. of Oklahoma Health Sciences Center 14 | # 15 | # 16 | from pymol import cmd 17 | import glob 18 | 19 | def loadFiles(files): 20 | """ 21 | load_files 22 | 23 | loads multiple files (using filename globbing) 24 | into a multiple objects named as the files are (e.g. collection of 25 | downloaded PDB files). 26 | 27 | e.g. load_files prot_*.pdb 28 | """ 29 | file_list = glob.glob(files) 30 | if file_list: 31 | file_list.sort() 32 | for i in file_list: 33 | cmd.load(i) 34 | else: 35 | print("No files found for pattern %s" % files) 36 | 37 | $0 38 | -------------------------------------------------------------------------------- /python-mode/loadAndAlignManyFiles3: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: loadAndAlignManyFiles3 4 | # name: These are the instructions for loading and aligning multiple files. 5 | # group: Objects 6 | # key: loadAndAlignManyFiles3 7 | # -- 8 | from pymol import cmd 9 | import glob 10 | import re 11 | 12 | 13 | def saveSep(prefix=""): 14 | """ 15 | Saves multiple objects into multiple files using an optional prefix name. 16 | This function is can save time. 17 | 18 | Usage in PyMOL: 19 | 20 | saveSep 21 | 22 | Usage in pymol"s Python API: 23 | 24 | cmd.do("saveSep ") 25 | 26 | e.g. saveSep prefix 27 | """ 28 | obj_list = cmd.get_names("all") 29 | 30 | if obj_list: 31 | for i in range(len(obj_list)): 32 | obj_name = "%s%s.pdb" % (prefix, obj_list[i]) 33 | cmd.save(obj_name, obj_list[i]) 34 | print("Saving %s" % obj_name) 35 | else: 36 | print("No objects found") 37 | 38 | 39 | cmd.extend("saveSep", saveSep) 40 | $0 41 | -------------------------------------------------------------------------------- /python-mode/obipythonSourceBlock: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: obipythonSourceBlock 4 | # name: Source block template in org-mode with the ob-ipython package. 5 | # group: Programming 6 | # key: obipythonSourceBlock 7 | # -- 8 | #+BEGIN_SRC ipython :session py :kernel pymol.python :exports both :results raw drawer 9 | from pymol import cmd 10 | cmd.do("reinitialize") 11 | cmd.bg_color("white") 12 | cmd.do("fetch 6VXX") 13 | cmd.do("zoom (resi 614 and chain A)") 14 | cmd.label(selection="chain A and resi 614 and name CB", expression=""%s-%s" % (resn,resi)") 15 | cmd.do("set label_color, black; set label_size, 48") 16 | cmd.do("set stick_radius, 0.12") 17 | cmd.do("hide cartoon; show sticks") 18 | cmd.do("set ray_shadows, 0") 19 | cmd.do("draw") 20 | cmd.do("png /Users/blaine/D614Gipython3.png, 600, 360, dpi=600") 21 | from IPython.display import Image 22 | from IPython.core.display import HTML 23 | PATH = "/Users/blaine/" 24 | Image(filename = PATH + "D614Gipython3.png", width=600, unconfined=True) 25 | #+END_SRC 26 | 27 | #+RESULTS: 28 | $0 29 | -------------------------------------------------------------------------------- /python-mode/emacsjupyterSourceBlock: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: emacsjupyterSourceBlock 4 | # name: Source block template in org-mode with emacs-jupyter package. 5 | # group: Programming 6 | # key: emacsjupyterSourceBlock 7 | # -- 8 | #+BEGIN_SRC jupyter-python :session py :kernel pymol.python :exports both :results raw drawer 9 | from pymol import cmd 10 | cmd.do("reinitialize") 11 | cmd.bg_color("white") 12 | cmd.do("fetch 6VXX") 13 | cmd.do("zoom (resi 614 and chain A)") 14 | cmd.label(selection="chain A and resi 614 and name CB", expression=""%s-%s" % (resn,resi)") 15 | cmd.do("set label_color, black; set label_size, 48") 16 | cmd.do("set stick_radius, 0.12") 17 | cmd.do("hide cartoon; show sticks") 18 | cmd.do("set ray_shadows, 0") 19 | cmd.do("draw") 20 | cmd.do("png /Users/blaine/D614Gipython3.png, 600, 360, dpi=600") 21 | from IPython.display import Image 22 | from IPython.core.display import HTML 23 | PATH = "/Users/blaine/" 24 | Image(filename = PATH + "D614Gipython3.png", width=600, unconfined=True) 25 | #+END_SRC 26 | 27 | #+RESULTS: 28 | $0 29 | -------------------------------------------------------------------------------- /python-mode/nucleicAcidFlatRibbonColorbySequence: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nucleicAcidFlatRibbonColorbySequence 4 | # name: This code colors the nucleotides by base seqence. It can be applied to any nucleic acid. It is dervied from the CR shortcut. The backcone is shown as a flatten ribbon. 5 | # group: NucleicAcids 6 | # key: nucleicAcidFlatRibbonColorbySequence 7 | # -- 8 | cmd.do("bg_color white;") 9 | cmd.do("set cartoon_oval_length, ${1:1.85};") 10 | cmd.do("set cartoon_oval_width, ${2:0.5};") 11 | cmd.do("cartoon oval;") 12 | cmd.do("set cartoon_ring_mode, ${3:3};") 13 | cmd.do("# set the color of the backbone oval;") 14 | cmd.do("set cartoon_nucleic_acid_color, ${4:blue};") 15 | cmd.do("select rna_A, resn A;") 16 | cmd.do("select rna_C, resn C;") 17 | cmd.do("select rna_G, resn G;") 18 | cmd.do("select rna_U, resn U;") 19 | cmd.do("select dna_T, resn T;") 20 | cmd.do("color ${5:yellow}, rna_A;") 21 | cmd.do("color ${6:red}, rna_C; ") 22 | cmd.do("color ${7:gray40}, rna_G;") 23 | cmd.do("color ${8:palecyan}, rna_U;") 24 | cmd.do("color ${9:brown}, dna_T;") 25 | cmd.do("as cartoon;") 26 | $0 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /python-mode/bsfr: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: bsfr 4 | # name: Ball-and-stick plus filled ring representation for ligands. 5 | # group: MolecularRepresentation 6 | # key: bsfr 7 | # -- 8 | cmd.do("# Edit the selection that is named ligand here.;") 9 | cmd.do("create ligand, ${1:/bluComplex/C/A/1101};") 10 | cmd.do("preset.ball_and_stick(selection=\"ligand\");") 11 | cmd.do("util.cbaw ligand;") 12 | cmd.do("set stick_color, white, ligand;") 13 | cmd.do("set valence, off, ligand;") 14 | cmd.do("unset valence;") 15 | cmd.do("# above command is required after using preset;") 16 | cmd.do("set sphere_color, black, elem C and ligand;") 17 | cmd.do("set sphere_color, red, elem O and ligand;") 18 | cmd.do("set sphere_color, blue, elem N and ligand;") 19 | cmd.do("set sphere_color, lightblue, elem F and ligand;") 20 | cmd.do("set stick_radius, 0.12;") 21 | cmd.do("set sphere_quality, 4;") 22 | cmd.do("set cartoon_ring_finder, 4, ligand;") 23 | cmd.do("set cartoon_ring_mode, 3, ligand;") 24 | cmd.do("set cartoon_ring_width, 0.12, ligand;") 25 | cmd.do("set cartoon_ring_transparency, .0, ligand;") 26 | cmd.do("show cartoon, ligand;") 27 | $0 28 | -------------------------------------------------------------------------------- /python-mode/scaleRadiusColorpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: scaleRadiusColorpy 4 | # name: Scale the radius and color of atoms as spheres by property in the B-value column. 5 | # group: MolecularRepresentation 6 | # key: scaleRadiusColorpy 7 | # -- 8 | cmd.do("bg_color white;") 9 | cmd.do("hide everything;") 10 | cmd.do("show spheres;") 11 | cmd.do("set stick_radius = 0.1;") 12 | cmd.do("hide everything, HET;") 13 | cmd.do("show spheres, HET;") 14 | cmd.do("set sphere_quality=3;") 15 | cmd.do("show sticks, resi 1102;") 16 | cmd.do("from pymol import stored;") 17 | cmd.do("# set the stored array equal to the b−values or use your own values; ") 18 | cmd.do("stored.bb = [ ];") 19 | cmd.do("iterate all, stored.bb.append(b);") 20 | # scale the b−values; 21 | cmd.do("M = max(stored.bb);") 22 | cmd.do("scaledBB = map(lambda x: float (x/M), stored.bb);") 23 | count = 0; 24 | # set the sphere radii independently; 25 | for x in scaledBB: 26 | cmd.set("sphere_scale", x ,"ID %s"%count) 27 | count = count + 1 28 | cmd.do("spectrum b, selection=4gdx;") 29 | cmd.do("space cmyk;") 30 | cmd.do("set specular_intensity , 0.25;") 31 | $0 32 | -------------------------------------------------------------------------------- /python-mode/nucleicAcidDumbellCartoonColorbySequence: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nucleicAcidDumbellCartoonColorbySequence 4 | # name: This code colors by the nucleotides by base seqence. The backcone is shown as a flatten ribbon with rolled edges that give the dumbell effect. The code can be applied to any nucleic acid. The code is dervied from the CR and DU shortcuts. 5 | # group: NucleicAcids 6 | # key: nucleicAcidDumbellCartoonColorbySequence 7 | # -- 8 | cmd.do("bg_color white;") 9 | cmd.do("set cartoon_oval_length, ${1:1.85}") 10 | cmd.do("set cartoon_oval_width, ${2:0.5}") 11 | cmd.do("cartoon oval;") 12 | cmd.do("cartoon dumbbell;") 13 | cmd.do("set cartoon_dumbbell_width, 0.2;") 14 | cmd.do("set cartoon_dumbbell_radius, 0.4;") 15 | cmd.do("set cartoon_ring_mode, ${3:3};") 16 | cmd.do("# set the color of the backbone oval") 17 | cmd.do("set cartoon_nucleic_acid_color, ${4:blue};") 18 | cmd.do("select rna_A, resn A;") 19 | cmd.do("select rna_C, resn C;") 20 | cmd.do("select rna_G, resn G;") 21 | cmd.do("select rna_U, resn U;") 22 | cmd.do("select dna_T, resn T;") 23 | cmd.do("color ${5:yellow}, rna_A;") 24 | cmd.do("color ${6:red}, rna_C; ") 25 | cmd.do("color ${7:gray40}, rna_G;") 26 | cmd.do("color ${8:palecyan}, rna_U;") 27 | cmd.do("color ${9:brown}, dna_T;") 28 | cmd.do("as cartoon;") 29 | $0 30 | -------------------------------------------------------------------------------- /python-mode/nucleicAcidCartoon2Strands: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: nucleicAcidCartoon2Strands 4 | # name: Coloring two strand differently of a double helix makes it easier to for the viewer to distinguish the two strands. The set command has the syntax of setting_name [, setting_value [, selection [,state ]]] . In this case, the selection has to be global, object, object-state, or per-atom settings. It cannot be a named selection. This is a weak spot in PyMOL. Coloring two strand differently of a double helix makes it easier to for the viewer to distinguish the two strands. Many double-stranded helices have one strand in the asymmetric unit. The second strand is in the biological unit. The coordinates for the second strand are in the pdb1 file type at the PDB. The second strand is in the second state, which is equivalent to the second model in the pdb file. The strands are labeled chain A and B (via the cartoon_nucliec_acid_color setting). The bases are colored differently too (via the cartoon_ladder_color setting). 5 | # group: NucleicAcids 6 | # key: nucleicAcidCartoon2Strands 7 | # -- 8 | cmd.do("fetch ${1:3nd3}, ${2:3nd3}, type=${3:pdb1};") 9 | cmd.do("set all_states, on;") 10 | cmd.do("create chA, ${2:3nd3}, 1, 1;") 11 | cmd.do("create chB, ${2:3nd3}, 2, 1;") 12 | cmd.do("# colors only the backbone;") 13 | cmd.do("set cartoon_nucleic_acid_color, ${4:magenta}, chA;") 14 | cmd.do("set cartoon_nucleic_acid_color, ${5:orange}, chB;") 15 | cmd.do("# color the bases;") 16 | cmd.do("set cartoon_ladder_color, ${6:density}, chA;") 17 | cmd.do("set cartoon_ladder_color, ${7:yellow}, chB;") 18 | $0 19 | -------------------------------------------------------------------------------- /python-mode/basePairStacking: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: basePairStacking 4 | # name: This code make as standard base stacking diagram with ball and stick representation. 5 | # group: NucleicAcids 6 | # key: basePairStacking 7 | # -- 8 | cmd.do("delete all;") 9 | cmd.do("fetch 4PCO, type=pdb, async=0;") 10 | cmd.do("select G2G3, ( ((resi 2 or resi 3) and chain A) or ((resi 8 or resi 9) and chain B));") 11 | cmd.do("remove not G2G3;") 12 | cmd.do("bg_color white;") 13 | cmd.do("show sticks;") 14 | cmd.do("set stick_radius=0.14;") 15 | cmd.do("set stick_ball, on; ") 16 | cmd.do("set stick_ball_ratio,1.9;") 17 | 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);") 18 | cmd.do("remove name H*;") 19 | cmd.do("select carbon1, element C and (resi 3 or resi 8) ") 20 | cmd.do("# select lower base pair;") 21 | cmd.do("select carbon2, element C and (resi 2 or resi 9) ") 22 | cmd.do("#select upper base pair;") 23 | cmd.do("color gray70, carbon1;") 24 | cmd.do("color gray10, carbon2;") 25 | cmd.do("show sticks;") 26 | cmd.do("space cmyk;") 27 | cmd.do("distance hbond1, /4PCO//B/U`9/N3,/4PCO//A/G`2/O6;") 28 | cmd.do("distance hbond2, /4PCO//B/U`9/O2,/4PCO//A/G`2/N1;") 29 | cmd.do("distance hbond3, /4PCO//A/U`3/N3,/4PCO//B/G`8/O6;") 30 | cmd.do("distance hbond4, /4PCO//A/U`3/O2,/4PCO//B/G`8/N1;") 31 | cmd.do("color black, hbond1;") 32 | cmd.do("color black, hbond2;") 33 | cmd.do("color gray70, hbond3;") 34 | cmd.do("color gray70, hbond4;") 35 | cmd.do("show nb_spheres;") 36 | cmd.do("set nb_spheres_size, 0.35;") 37 | cmd.do("hide labels;") 38 | cmd.do("ray 1600,1000;") 39 | cmd.do("png 4PCO.png;") 40 | $0 41 | -------------------------------------------------------------------------------- /python-mode/stack: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: stack 4 | # name: Base-stacking figure. 5 | # group: MolecularRepresentation 6 | # key: stack 7 | # -- 8 | cmd.do("delete all;") 9 | cmd.do("fetch ${1:4PCO}, type=pdb,async=0;") 10 | 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) );") 11 | cmd.do("hide everything, element h; ") 12 | cmd.do("remove not ${2:G2G3};") 13 | cmd.do("bg_color white;") 14 | cmd.do("show sticks;") 15 | cmd.do("set stick_radius=0.14;") 16 | cmd.do("set stick_ball, on; ") 17 | cmd.do("set stick_ball_ratio,1.9;") 18 | 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);") 19 | cmd.do("hide everything, element H;") 20 | cmd.do("select carbon1, element C and (resi ${4:3} or resi ${5:8}); ") 21 | cmd.do("# select lower base pair;") 22 | cmd.do("select carbon2, element C and (resi ${3:2} or resi ${6:9});") 23 | cmd.do("#select upper base pair;") 24 | cmd.do("color gray70,carbon1;") 25 | cmd.do("color gray10,carbon2;") 26 | cmd.do("space cmyk;") 27 | cmd.do("distance hbond1,/${1:4PCO}//B/U`9/N3,/${1:4PCO}//A/G`2/O6;") 28 | cmd.do("distance hbond2,/${1:4PCO}//B/U`9/O2,/${1:4PCO}//A/G`2/N1;") 29 | cmd.do("distance hbond3,/${1:4PCO}//A/U`3/N3,/${1:4PCO}//B/G`8/O6;") 30 | cmd.do("distance hbond4,/${1:4PCO}//A/U`3/O2,/${1:4PCO}//B/G`8/N1;") 31 | cmd.do("color black, hbond1;") 32 | cmd.do("color black, hbond2;") 33 | cmd.do("color gray70, hbond3;") 34 | cmd.do("color gray70, hbond4;") 35 | cmd.do("show nb_spheres;") 36 | cmd.do("set nb_spheres_size, 0.35;") 37 | cmd.do("hide labels;") 38 | cmd.do("ray 1600,1000;") 39 | cmd.do("png ${1:4PCO}.png") 40 | $0 41 | -------------------------------------------------------------------------------- /python-mode/rvr: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rvr 4 | # name: Return settings in rounded format while running PyMOL via the RCP server rdkit in a jupyter notebook. This is a modified version of the roundview.py script. 5 | # group: Jupyter 6 | # key: rvr 7 | # -- 8 | def rvr(StoredView=0, decimal_places=2, outname="roundedview.txt"): 9 | """MIT License 10 | Copyright: 11 | Blaine Mooers and the OU Board of Regents 12 | University of Oklahoma Health Sciences Center 13 | Oklahoma City, OK 73104 14 | 30 April 2020 15 | 16 | First run the following: 17 | 18 | from rdkit.Chem import PyMol 19 | s = PyMol.MolViewer() 20 | du = s.server.do 21 | 22 | """ 23 | StoredView = int(StoredView) decimal_places = int(decimal_places) 24 | #call the get_view function 25 | m = s.get_view(StoredView) 26 | #Make a list of the elements in the orientation matrix. 27 | myList = [m[0], m[1], m[2], m[3], m[4], m[5], m[6],m[7], m[8], m[9], 28 | m[10], m[11], m[12], m[13], m[14],m[15], m[16], m[17]] 29 | #Round off the matrix elements to two decimal places (two fractional places) 30 | #This rounding approach solved the problem of unwanted 31 | #whitespaces when I tried to use a string format statement 32 | myRoundedList = [round(elem, decimal_places) for elem in myList] 33 | #x is the string template for the output. The whitespace is required 34 | #between the "set_view" and "(" 35 | x = "set_view ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17});" 36 | # Print to the command history window. 37 | print(x.format(*myRoundedList)) 38 | #Write to a text file. 39 | myFile = open("roundedview.txt", "a") myFile.write(x.format(*myRoundedList) + "") myFile.close() 40 | return myRoundedList 41 | $0 42 | -------------------------------------------------------------------------------- /python-mode/carvedIsomesh: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: carvedIsomesh 4 | # name: Carved isomesh representation of electron density. 5 | # group: ElectronDensity 6 | # key: carvedIsomesh 7 | # -- 8 | cmd.do("delete all;") 9 | cmd.do("# Fetch the coordinates. Need internet connection.") 10 | cmd.do("fetch ${1:4dgr}, async=0;") 11 | cmd.do("# Fetch the electron density map.") 12 | cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;") 13 | cmd.do("# create a selection out of the glycan") 14 | cmd.do("select ${2:LongGlycan}, resi ${3:469:477};") 15 | cmd.do("orient ${2:LongGlycan};") 16 | cmd.do("remove not ${2:LongGlycan};") 17 | cmd.do("remove name H*;") 18 | cmd.do("isomesh 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 19 | cmd.do("color density, 2fofcmap; ") 20 | cmd.do("show sticks;") 21 | cmd.do("show spheres;") 22 | cmd.do("set stick_radius, .07;") 23 | cmd.do("set sphere_scale, .19;") 24 | cmd.do("set sphere_scale, .13, elem H;") 25 | cmd.do("set bg_rgb=[1, 1, 1];") 26 | cmd.do("set stick_quality, 50;") 27 | cmd.do("set sphere_quality, 4;") 28 | cmd.do("color gray85, elem C;") 29 | cmd.do("color red, elem O;") 30 | cmd.do("color slate, elem N;") 31 | cmd.do("color gray98, elem H;") 32 | cmd.do("set stick_color, gray50;") 33 | cmd.do("set ray_trace_mode, 1;") 34 | cmd.do("set ray_texture, 2;") 35 | cmd.do("set antialias, 3;") 36 | cmd.do("set ambient, 0.5;") 37 | cmd.do("set spec_count, 5;") 38 | cmd.do("set shininess, 50;") 39 | cmd.do("set specular, 1;") 40 | cmd.do("set reflect, .1;") 41 | cmd.do("set dash_gap, 0;") 42 | cmd.do("set dash_color, black;") 43 | cmd.do("set dash_gap, .15;") 44 | cmd.do("set dash_length, .05;") 45 | cmd.do("set dash_round_ends, 0;") 46 | cmd.do("set dash_radius, .05;") 47 | 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);") 48 | cmd.do("preset.ball_and_stick(\"all\",mode=1);") 49 | cmd.do("draw;") 50 | $0 51 | -------------------------------------------------------------------------------- /python-mode/carvedIsosurface: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: carvedIsosurface 4 | # name: Carved isosurface representation of electron density. 5 | # group: ElectronDensity 6 | # key: carvedIsosurface 7 | # -- 8 | cmd.do("delete all;") 9 | cmd.do("# Fetch the coordinates. Need internet connection.;") 10 | cmd.do("fetch ${1:4dgr}, async=0;") 11 | cmd.do("# Fetch the electron density map.;") 12 | cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;") 13 | cmd.do("# create a selection out of the glycan;") 14 | cmd.do("select ${2:LongGlycan}, resi ${3:469:477};") 15 | cmd.do("orient ${2:LongGlycan};") 16 | cmd.do("remove not ${2:LongGlycan};") 17 | cmd.do("remove name H*;") 18 | cmd.do("isosurface 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 19 | cmd.do("color density, 2fofcmap; ") 20 | cmd.do("show sticks;") 21 | cmd.do("show spheres;") 22 | cmd.do("set stick_radius, .07;") 23 | cmd.do("set sphere_scale, .19;") 24 | cmd.do("set sphere_scale, .13, elem H;") 25 | cmd.do("set bg_rgb=[1, 1, 1];") 26 | cmd.do("set stick_quality, 50;") 27 | cmd.do("set sphere_quality, 4;") 28 | cmd.do("color gray85, elem C;") 29 | cmd.do("color red, elem O;") 30 | cmd.do("color slate, elem N;") 31 | cmd.do("color gray98, elem H;") 32 | cmd.do("set stick_color, gray50;") 33 | cmd.do("set ray_trace_mode, 1;") 34 | cmd.do("set ray_texture, 2;") 35 | cmd.do("set antialias, 3;") 36 | cmd.do("set ambient, 0.5;") 37 | cmd.do("set spec_count, 5;") 38 | cmd.do("set shininess, 50;") 39 | cmd.do("set specular, 1;") 40 | cmd.do("set reflect, .1;") 41 | cmd.do("set dash_gap, 0;") 42 | cmd.do("set dash_color, black;") 43 | cmd.do("set dash_gap, .15;") 44 | cmd.do("set dash_length, .05;") 45 | cmd.do("set dash_round_ends, 0;") 46 | cmd.do("set dash_radius, .05;") 47 | 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);") 48 | cmd.do("preset.ball_and_stick(\"all\",mode=1);") 49 | cmd.do("draw;") 50 | $0 51 | -------------------------------------------------------------------------------- /python-mode/listLigandProteinDistances: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: listLigandProteinDistances 4 | # name: Print a list of protein--ligand distances. Code by Dan Kulp. Updated for Python3. 5 | # group: Measurements 6 | # key: listLigandProteinDistances 7 | # -- 8 | from pymol import cmd 9 | """ 10 | Find all distances betwen all ligand atoms and all protein atoms. 11 | 12 | Adapted and updated from script by Dan Kulp posted here 13 | https://sourceforge.net/p/pymol/mailman/message/10097804/ 14 | 15 | There are probably better solutions like finding just the 16 | distances to proein atoms within a certain distance from 17 | the ligand. 18 | 19 | Due to the nested for loops, this script is takes several second 20 | to run on a medium-sized human protein. This script is a 21 | good candidate for vectorization. 22 | 23 | It is also a good candiate for becoming a function and a shortcut. 24 | 25 | """ 26 | 27 | # customize these lines to your protein. 28 | cmd.fetch("6NEC") 29 | cmd.select("prot","not resn XIN and not resn HOH and not chain C") 30 | cmd.select("lig", "resn XIN and not chain C") 31 | 32 | dist_list = {} 33 | pro_atoms = cmd.get_model("prot") 34 | lig_atoms = cmd.get_model("lig") 35 | 36 | for l_at in lig_atoms.atom: 37 | for p_at in pro_atoms.atom: 38 | dist_list[str(l_at.resn) + 39 | ":" + 40 | str(l_at.resi) + 41 | " " + 42 | l_at.name + 43 | " ---- " + 44 | str(p_at.resn) + 45 | ":" + 46 | str(p_at.resi) + 47 | " " + 48 | p_at.name] = cmd.dist("foo", 49 | "index " + 50 | str(l_at.index),"index " + str(p_at.index)) 51 | cmd.delete("foo") 52 | print("List of all pairwise ligand--protein atom-atom distances:") 53 | # [print("Distance of " + d + " is " + str(dist_list[d])) for d in dist_list.keys()] 54 | 55 | # More compact print statement. Need an f-string format statement. 56 | [print( d + " " + str(dist_list[d])) for d in dist_list.keys()] 57 | $0 58 | -------------------------------------------------------------------------------- /python-mode/carvedVolume: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: carvedVolume 4 | # name: Carved volume representation of electron density. 5 | # group: ElectronDensity 6 | # key: carvedVolume 7 | # -- 8 | cmd.do("delete all;") 9 | cmd.do("# Fetch the coordinates. Need internet connection.;") 10 | cmd.do("fetch ${1:4dgr}, async=0;") 11 | cmd.do("# Fetch the electron density map.;") 12 | cmd.do("fetch ${1:4dgr}, type=2fofc,async=0;") 13 | cmd.do("# create a selection out of the glycan;") 14 | cmd.do("select ${2:LongGlycan}, resi ${3:469:477};") 15 | cmd.do("# oreint the long axes of the object along the x-axis;") 16 | cmd.do("orient ${2:LongGlycan};") 17 | cmd.do("# remove everything except the glycan;") 18 | cmd.do("remove not ${2:LongGlycan};") 19 | cmd.do("# remove the remaining hydrogen atoms;") 20 | cmd.do("remove name H*;") 21 | cmd.do("# show the electron density map as a surface.") 22 | cmd.do("surface 2fofcmap, ${1:4dgr}_2fofc, 1, ${2:LongGlycan}, carve = 1.8;") 23 | cmd.do("color density, 2fofcmap; ") 24 | cmd.do("show sticks;") 25 | cmd.do("show spheres;") 26 | cmd.do("set stick_radius, .07;") 27 | cmd.do("set sphere_scale, .19;") 28 | cmd.do("set sphere_scale, .13, elem H;") 29 | cmd.do("set bg_rgb=[1, 1, 1];") 30 | cmd.do("set stick_quality, 50;") 31 | cmd.do("# make the spheres smooth with larger settings.;") 32 | cmd.do("set sphere_quality, 4;") 33 | cmd.do("# gray85 is off-white, gray0 is black;") 34 | cmd.do("color gray85, elem C;") 35 | cmd.do("color red, elem O;") 36 | cmd.do("color slate, elem N;") 37 | cmd.do("color gray98, elem H;") 38 | cmd.do("set stick_color, gray50;") 39 | cmd.do("set ray_trace_mode, 1;") 40 | cmd.do("set ray_texture, 2;") 41 | cmd.do("set antialias, 3;") 42 | cmd.do("set ambient, 0.5;") 43 | cmd.do("set spec_count, 5;") 44 | cmd.do("set shininess, 50;") 45 | cmd.do("set specular, 1;") 46 | cmd.do("set reflect, .1;") 47 | cmd.do("set dash_gap, 0;") 48 | cmd.do("set dash_color, black;") 49 | cmd.do("set dash_gap, .15;") 50 | cmd.do("set dash_length, .05;") 51 | cmd.do("set dash_round_ends, 0;") 52 | cmd.do("set dash_radius, .05;") 53 | 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);") 54 | cmd.do("preset.ball_and_stick(\"all\",mode=1);") 55 | cmd.do("draw;") 56 | $0 57 | -------------------------------------------------------------------------------- /python-mode/addAxispy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: addAxispy 4 | # name: Adds the function draw_axis(). Could be useful for the adding a symmery axis, a ncs axis, or scale bar to a scene. 5 | # group: UnitCellDisplay 6 | # key: addAxispy 7 | # -- 8 | from pymol.cgo import * # get constants 9 | from pymol import cmd 10 | 11 | import math 12 | 13 | class Counter: 14 | """ 15 | draw_line 16 | source https://www.pymolwiki.org/index.php/Symmetry_Axis 17 | 18 | Pymol script copyright Matthew O"Meara and Xavier Ambroggio 2007 19 | 20 | Under GNU Free Documentation License 1.2 21 | 22 | Example: 23 | 24 | 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) 25 | 26 | Updated 15 June 2020 27 | Blaine Mooers 28 | 29 | Notes: 30 | 1) Could be useful for the adding a symmery axis, a ncs axis, or scale bar to a scene. 31 | 2) The postion (xyz) is the middle of the line, not one end as expected for a vector. 32 | 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) 33 | 4) Changed print statement to Python3 print function. 34 | 5) Replaced cmd.extend() with function generator. 35 | """ 36 | def __init__(self): 37 | self.state = 1 38 | counter = Counter() 39 | 40 | @cmd.extend 41 | 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 ): 42 | if x == None or y == None or z == None or i == None or j == None or k== None : 43 | print("Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width") 44 | print("draw a line centered at (x,y,z) with the direction vector (i,j,k)") 45 | print("length, color (r,g,b), and width arguments are optional") 46 | # print "For a fun example of the command, run draw_axis_example" 47 | else : 48 | x,y,z = float(x), float(y), float(z) 49 | i,j,k = float(i), float(j), float(k) 50 | r,g,b = float(r), float(g), float(b) 51 | width = float(width) 52 | length = float(length) / 2.0 53 | 54 | x1,y1,z1 = (x+i*length,y+j*length,z+k*length) 55 | x2,y2,z2 = (x-i*length,y-j*length,z-k*length) 56 | 57 | obj = [ 58 | LINEWIDTH, width, 59 | BEGIN, LINES, 60 | 61 | COLOR, r, g, b, 62 | VERTEX, x1, y1, z1, 63 | VERTEX, x2, y2, z2, 64 | 65 | END 66 | ] 67 | 68 | cmd.load_cgo(obj,"axis"+str(counter.state)) 69 | counter.state += 1 70 | $0 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Version](https://img.shields.io/static/v1?label=jupyter-emacs-pymolpysnips&message=0.2&color=brightcolor) 2 | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) 3 | 4 | # jupyter-emacs-pymolpysnips 5 | PyMOL Python snippet library to edit live Jupyter notebook cells with Emacs using the [GhostText web browser extension](https://github.com/fregante/GhostText) and the [atomic-chrome.el](https://github.com/alpha22jp/atomic-chrome) library. 6 | 7 | ## Installation 8 | The snippets are stored one per yasnippet file. 9 | The snippets are usually stored in `~/.emacs.d/snippets/python-mode`. 10 | 11 | ## Note 12 | 13 | Some snippets depend on some pymolshortcuts. 14 | Add the [pymolshortcuts.py](https://github.com/MooersLab/pymolshortcuts) file to your working directory. 15 | 16 | ## Related repositories 17 | 18 | - [jupyterlabpymolpysnips](https://github.com/MooersLab/jupyterlabpymolpysnips) PyMOL Python snippets for use in JupyterLab with the jupyterlab-snippets extension. 19 | - [jupyternbclassicpymolpysnipsplus](https://github.com/MooersLab/jupyternbclassicpymolpysnipsplus) 20 | - [taggedpymolpysnips](https://github.com/MooersLab/taggedpymolpysnips) 21 | - [taggedpymolpysnipspymolpysnipsplus](https://github.com/MooersLab/taggedpymolpysnipspymolpysnipsplus) 22 | - [jupyter-vsc-pymolpysnips](https://github.com/MooersLab/jupytervsc-pymolpysnips) 23 | - [jupyter-st3-pymolpysnips](https://github.com/MooersLab/jupyter-st3-pymolpysnips) 24 | - [jupyter-emacs-pymolpysnips](https://github.com/MooersLab/jupyter-emacs-pymolpysnips) 25 | - [jupyter-ultisnips-pymolpysnips](https://github.com/MooersLab/jupyter-ultisnips-pymolpysnips) 26 | - [jupyter-snipmate-pymolpysnips](https://github.com/MooersLab/jupyter-snipmate-pymolpysnips) 27 | - [jupyter-neosnippets-pymolpysnips](https://github.com/MooersLab/jupyter-neosnippets-pymolpysnips) 28 | - [jupyter-atom-pymolpysnips](https://github.com/MooersLab/jupyter-atom-pymolpysnips) 29 | 30 | ## Update history 31 | 32 | |Version | Changes | Date | 33 | |:-----------:|:------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------:| 34 | | Version 0.2 | Added badges, funding, and update table | 2024 May 18 | 35 | 36 | ## Funding 37 | - NIH: R01 CA242845, R01 AI088011 38 | - NIH: P30 CA225520 (PI: R. Mannel); P20GM103640 and P30GM145423 (PI: A. West) 39 | 40 | -------------------------------------------------------------------------------- /python-mode/grayscalepy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: grayscalepy 4 | # name: Apply grayscale coloring using a grayscale version of the PyMOL colors for the elements. This is a Python function. It is invoked in a script file via gscale(). There is a corresponding gscale shortcut in pymolshortcuts.py that is invoked in a pml script by entering gsale if the functions in pymolshortcuts.py have been loaded with the run pymolshortcuts.py command. 5 | # group: MolecularRepresentation 6 | # key: grayscalepy 7 | # -- 8 | from pymol.cgo import * # get constants 9 | from pymol import cmd 10 | 11 | import math 12 | 13 | class Counter: 14 | """ 15 | draw_line 16 | source https://www.pymolwiki.org/index.php/Symmetry_Axis 17 | 18 | Pymol script copyright Matthew O"Meara and Xavier Ambroggio 2007 19 | 20 | Under GNU Free Documentation License 1.2 21 | 22 | Example: 23 | 24 | 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) 25 | 26 | Updated 15 June 2020 27 | Blaine Mooers 28 | 29 | Notes: 30 | 1) Could be useful for the adding a symmery axis, a ncs axis, or scale bar to a scene. 31 | 2) The postion (xyz) is the middle of the line, not one end as expected for a vector. 32 | 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) 33 | 4) Changed print statement to Python3 print function. 34 | 5) Replaced cmd.extend() with function generator. 35 | """ 36 | def __init__(self): 37 | self.state = 1 38 | counter = Counter() 39 | 40 | @cmd.extend 41 | 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 ): 42 | if x == None or y == None or z == None or i == None or j == None or k== None : 43 | print("Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width") 44 | print("draw a line centered at (x,y,z) with the direction vector (i,j,k)") 45 | print("length, color (r,g,b), and width arguments are optional") 46 | # print "For a fun example of the command, run draw_axis_example" 47 | else : 48 | x,y,z = float(x), float(y), float(z) 49 | i,j,k = float(i), float(j), float(k) 50 | r,g,b = float(r), float(g), float(b) 51 | width = float(width) 52 | length = float(length) / 2.0 53 | 54 | x1,y1,z1 = (x+i*length,y+j*length,z+k*length) 55 | x2,y2,z2 = (x-i*length,y-j*length,z-k*length) 56 | 57 | obj = [ 58 | LINEWIDTH, width, 59 | BEGIN, LINES, 60 | 61 | COLOR, r, g, b, 62 | VERTEX, x1, y1, z1, 63 | VERTEX, x2, y2, z2, 64 | 65 | END 66 | ] 67 | 68 | cmd.load_cgo(obj,"axis"+str(counter.state)) 69 | counter.state += 1 70 | $0 71 | -------------------------------------------------------------------------------- /python-mode/coordinate: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: coordinate 4 | # name: Coordinate covalent bonds to metals and H-bonds from RNA. 5 | # group: MolecularRepresentation 6 | # key: coordinate 7 | # -- 8 | cmd.do("viewport 900,600;") 9 | cmd.do("fetch 3nd4, type=pdb, async=0;") 10 | cmd.do("run ~/Scripts/PyMOLScripts/quat.py;") 11 | cmd.do("quat 3nd4;") 12 | cmd.do("show sticks;") 13 | cmd.do("set stick_radius=0.125;") 14 | cmd.do("hide everything, name H*;") 15 | cmd.do("bg_color white;") 16 | 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)));") 17 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/A`3/N7);") 18 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`119/O);") 19 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`219/O);") 20 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`319/O);") 21 | cmd.do("bond (coorCov//A/NA`19/NA),(coorCov//A/HOH`519/O);") 22 | cmd.do("distance (3nd4_1 and chain Aand resi 19 and name NA), (3nd4_1 and chain A and resi 519);") 23 | cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 419);") 24 | cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 319);") 25 | cmd.do("distance (3nd4_1 and chain A and resi 19 and name NA), (3nd4_1 and chain A and resi 219);") 26 | cmd.do("show nb_spheres; ") 27 | cmd.do("set nb_spheres_size, .35;") 28 | cmd.do("distance hbond1,/3nd4_1/1/A/HOH`119/O, /3nd4_1/1/A/A`3/OP2;") 29 | cmd.do("distance hbond2,/3nd4_1/1/A/HOH`319/O, /3nd4_1/1/A/A`3/OP2;") 30 | cmd.do("distance hbond3,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/HOH`119/O;") 31 | cmd.do("distance hbond4,/3nd4_1/1/A/G`4/N7,/3nd4_1/1/A/HOH`91/O;") 32 | cmd.do("distance hbond5,/3nd4_1/1/A/G`4/O6, /3nd4_1/1/A/HOH`419/O;") 33 | cmd.do("distance hbond6,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/G`4/OP2;") 34 | cmd.do("distance hbond7,/3nd4_1/1/A/HOH`319/O,/3nd4_1/1/A/G`2/OP2;") 35 | cmd.do("distance hbond9,/3nd4_1/1/A/HOH`419/O,/3nd4_2/2/A/HOH`74/O;") 36 | cmd.do("distance hbond10,/3nd4_2/2/A/C`15/O2,/3nd4_1/1/A/G`2/N2;") 37 | cmd.do("distance hbond11, /3nd4_2/2/A/C`15/N3,/3nd4_1/1/A/G`2/N1;") 38 | cmd.do("distance hbond12,/3nd4_2/2/A/C`15/N4,/3nd4_1/1/A/G`2/O6;") 39 | cmd.do("distance hbond13, /3nd4_2/2/A/U`14/N3,/3nd4_1/1/A/A`3/N1;") 40 | cmd.do("distance hbond14,3nd4_2/2/A/U`14/O4,/3nd4_1/1/A/A`3/N6;") 41 | cmd.do("distance hbond15, /3nd4_2/2/A/C`13/N4,/3nd4_1/1/A/G`4/O6;") 42 | cmd.do(" distance hbond16,/3nd4_2/2/A/C`13/N3, /3nd4_1/1/A/G`4/N1;") 43 | cmd.do("distance hbond17, /3nd4_1/1/A/G`4/N2,/3nd4_2/2/A/C`13/O2;") 44 | cmd.do("distance hbond18,/3nd4_1/1/A/G`2/N2,/3nd4_2/2/A/C`15/O2;") 45 | cmd.do("distance hbond19,/3nd4_1/1/A/HOH`91/O,/3nd4_1/1/A/G`4/OP2; ") 46 | cmd.do("set depth_cue=0;") 47 | cmd.do("set ray_trace_fog=0;") 48 | cmd.do("set dash_color, black;") 49 | cmd.do("set label_font_id, 5;") 50 | cmd.do("set label_size, 36;") 51 | cmd.do("set label_position, (0.5, 1.0, 2.0);") 52 | cmd.do("set label_color, black;") 53 | cmd.do("set dash_gap, 0.2;") 54 | cmd.do("set dash_width, 2.0;") 55 | cmd.do("set dash_length, 0.2;") 56 | cmd.do("set label_color, black;") 57 | cmd.do("set dash_gap, 0.2;") 58 | cmd.do("set dash_width, 2.0;") 59 | cmd.do("set dash_length, 0.2;") 60 | cmd.do("select carbon, element C;") 61 | cmd.do("color yellow, carbon;") 62 | cmd.do("disable carbon;") 63 | 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)") 64 | $0 65 | -------------------------------------------------------------------------------- /python-mode/rvi: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: rvi 4 | # name: Return settings in rounded format while running PyMOL via the RCP server ipymol in a jupyter notebook. This is a modified version of the roundview.py script. 5 | # group: Jupyter 6 | # key: rvi 7 | # -- 8 | def rvj(StoredView=0, decimal_places=2, outname="roundedview.txt"): 9 | """ 10 | rvj() is a modification of the the rv() function (aka the roundview.py) 11 | so that it can run in Jupyter notebooks with the ipymol.viewer. 12 | A set_view string is printed to the noteobook in a format that is ready 13 | for reuse. 14 | 15 | The ipymol module was developed by Carlos Hernandez: 16 | 17 | https://github.com/cxhernandez/ipymol 18 | 19 | The pre-requisites for installing ipymol are as follows: 20 | 21 | 1. Make a jupyter notebook kernel for Python interpreter inside of 22 | the Schrodinger PyMOL. See the PyMOL Snippets GitHub Page for 23 | a description of how to make one. 24 | 2. Install the following build of ipymol at the PyMOL prompt. 25 | You need to log into your GitHub account first. 26 | 27 | pip install git+pip install git+https://github.com/cxhernandez/ipymol.git@2a30d6ec1588434e6f0f72a1d572444f89ff535b 28 | 29 | 3. Make a bash alias to this PyMOL app file. 30 | 31 | 4. Launch the jupyter notebook and select the pymol.python kernel. 32 | 33 | 5. Open a terminal instance from the File pulldown in jupyter notebook. 34 | 35 | 6. Enter `pymol -Rq` to launch an interactive instance of PyMOL. 36 | 37 | 7. Enter the following code to load ipymol and conmect to PyMOL 38 | 39 | from ipymol import viewer as ipv 40 | ipv.start() # Start PyMOL RPC server 41 | 42 | Now you can change the scene manually and send the display as static 43 | image to a cell in the jupyter notebook. 44 | 45 | It is assumed that the viewer class of the ipymol moduel has been 46 | imported as ipv. 47 | 48 | I made the following modifications of roundview.py. 49 | The cmd.get_view was replaced with ipv.get_view. 50 | The cmd.extend was replaced with ipv.extend. 51 | The myRoundedList was returned for further processing. 52 | 53 | MIT License 54 | 55 | Copyright: 56 | Blaine Mooers and the OU Board of Regents 57 | University of Oklahoma Health Sciences Center 58 | Oklahoma City, OK 73104 59 | 60 | 29 April 2020 61 | 62 | """ 63 | 64 | 65 | StoredView = int(StoredView) 66 | decimal_places = int(decimal_places) 67 | 68 | #call the get_view function 69 | 70 | m = ipv.get_view(StoredView) 71 | 72 | 73 | #Make a list of the elements in the orientation matrix. 74 | 75 | myList = [m[0], m[1], m[2], m[3], m[4], m[5], m[6],m[7], m[8], m[9], 76 | m[10], m[11], m[12], m[13], m[14],m[15], m[16], m[17]] 77 | 78 | #Round off the matrix elements to two decimal places (two fractional places) 79 | #This rounding approach solved the problem of unwanted 80 | #whitespaces when I tried to use a string format statement 81 | 82 | myRoundedList = [round(elem, decimal_places) for elem in myList] 83 | 84 | #x is the string template for the output. The whitespace is required 85 | #between the "set_view" and "(" 86 | 87 | x = "set_view ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17});" 88 | 89 | # Print to the command history window. 90 | print(x.format(*myRoundedList)) 91 | 92 | #Write to a text file. 93 | myFile = open("roundedview.txt", "a") 94 | myFile.write(x.format(*myRoundedList) + "") 95 | myFile.close() 96 | return myRoundedList 97 | $0 98 | -------------------------------------------------------------------------------- /python-mode/optAlignRNA: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # contributor: Blaine Mooers, bmooers1@gmail.com, github.com/MooersLab 3 | # key: optAlignRNA 4 | # name: OptiAlign.py by Jason Vertree modified for aligning multiple RNA structures. 5 | # group: Objects 6 | # key: optAlignRNA 7 | # -- 8 | #!python 9 | 10 | ############################################################################## 11 | # 12 | # @SUMMARY: -- QKabsch.py. A python implementation of the optimal superposition 13 | # of two sets of vectors as proposed by Kabsch 1976 & 1978. 14 | # 15 | # @AUTHOR: Jason Vertrees 16 | # @COPYRIGHT: Jason Vertrees (C), 2005-2007 17 | # @LICENSE: Released under GPL: 18 | # This program is free software; you can redistribute it and/or modify 19 | # it under the terms of the GNU General Public License as published by 20 | # the Free Software Foundation; either version 2 of the License, or 21 | # (at your option) any later version. 22 | # This program is distributed in the hope that it will be useful, but WITHOUT 23 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 24 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 25 | # 26 | # You should have received a copy of the GNU General Public License along with 27 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 28 | # Street, Fifth Floor, Boston, MA 02110-1301, USA 29 | # 30 | # DATE : 2007-01-01 31 | # REV : 2 32 | # REQUIREMENTS: numpy 33 | # 34 | # 35 | # Modified optAlign.py to use C1 prime carbon atoms of RNA for alignment. 36 | # Jan. 29, 2020 37 | # Blaine Mooers, PhD 38 | # Univ. of Oklahoma Health Sciences Center 39 | # 40 | ############################################################################# 41 | from array import * 42 | 43 | # system stuff 44 | import os 45 | import copy 46 | 47 | # pretty printing 48 | import pprint 49 | 50 | # for importing as a plugin into PyMol 51 | from pymol import cmd 52 | from pymol import stored 53 | from pymol import selector 54 | 55 | # using numpy for linear algebra 56 | import numpy 57 | 58 | def optAlignRNA( sel1, sel2 ): 59 | """ 60 | optAlignRNA performs the Kabsch alignment algorithm upon the C1" carbons of two selections. 61 | Example: optAlignRNA 1JU7 and i. 1-16 and n. C1", 1CLL and i. 4-146 and n. C1" 62 | 63 | Two RMSDs are returned. One comes from the Kabsch algorithm and the other from 64 | PyMOL based upon your selections. 65 | 66 | This function can be run in a for loop to fit multiple structures with a common prefix name: 67 | 68 | for x in cmd.get_names(): optAlignRNA(x, "1JU7_0001") 69 | 70 | or get the rmsds for all combinations, do the following: 71 | 72 | [[optAlignRNA(x, y) for x in cmd.get_names()] for y in cmd.get_names()] 73 | 74 | """ 75 | cmd.reset() 76 | 77 | # make the lists for holding coordinates 78 | # partial lists 79 | stored.sel1 = [] 80 | stored.sel2 = [] 81 | # full lists 82 | stored.mol1 = [] 83 | stored.mol2 = [] 84 | 85 | # -- CUT HERE 86 | sel1 += " and N. C1"" 87 | sel2 += " and N. C1"" 88 | # -- CUT HERE 89 | 90 | # Get the selected coordinates. We 91 | # align these coords. 92 | cmd.iterate_state(1, selector.process(sel1), "stored.sel1.append([x,y,z])") 93 | cmd.iterate_state(1, selector.process(sel2), "stored.sel2.append([x,y,z])") 94 | 95 | # get molecule name 96 | mol1 = cmd.identify(sel1,1)[0][0] 97 | mol2 = cmd.identify(sel2,1)[0][0] 98 | 99 | # Get all molecule coords. We do this because 100 | # we have to rotate the whole molcule, not just 101 | # the aligned selection 102 | cmd.iterate_state(1, mol1, "stored.mol1.append([x,y,z])") 103 | cmd.iterate_state(1, mol2, "stored.mol2.append([x,y,z])") 104 | 105 | # check for consistency 106 | assert len(stored.sel1) == len(stored.sel2) 107 | L = len(stored.sel1) 108 | assert L > 0 109 | 110 | # must alway center the two proteins to avoid 111 | # affine transformations. Center the two proteins 112 | # to their selections. 113 | COM1 = numpy.sum(stored.sel1,axis=0) / float(L) 114 | COM2 = numpy.sum(stored.sel2,axis=0) / float(L) 115 | stored.sel1 -= COM1 116 | stored.sel2 -= COM2 117 | 118 | # Initial residual, see Kabsch. 119 | 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) 120 | 121 | # 122 | # This beautiful step provides the answer. V and Wt are the orthonormal 123 | # bases that when multiplied by each other give us the rotation matrix, U. 124 | # S, (Sigma, from SVD) provides us with the error! Isn"t SVD great! 125 | V, S, Wt = numpy.linalg.svd( numpy.dot( numpy.transpose(stored.sel2), stored.sel1)) 126 | 127 | # we already have our solution, in the results from SVD. 128 | # we just need to check for reflections and then produce 129 | # the rotation. V and Wt are orthonormal, so their det"s 130 | # are +/-1. 131 | reflect = float(str(float(numpy.linalg.det(V) * numpy.linalg.det(Wt)))) 132 | 133 | if reflect == -1.0: 134 | S[-1] = -S[-1] 135 | V[:,-1] = -V[:,-1] 136 | 137 | RMSD = E0 - (2.0 * sum(S)) 138 | RMSD = numpy.sqrt(abs(RMSD / L)) 139 | 140 | #U is simply V*Wt 141 | U = numpy.dot(V, Wt) 142 | 143 | # rotate and translate the molecule 144 | stored.sel2 = numpy.dot((stored.mol2 - COM2), U) 145 | stored.sel2 = stored.sel2.tolist() 146 | # center the molecule 147 | stored.sel1 = stored.mol1 - COM1 148 | stored.sel1 = stored.sel1.tolist() 149 | 150 | # let PyMol know about the changes to the coordinates 151 | cmd.alter_state(1,mol1,"(x,y,z)=stored.sel1.pop(0)") 152 | cmd.alter_state(1,mol2,"(x,y,z)=stored.sel2.pop(0)") 153 | 154 | #print("Moved: %s Reference: %s RMSD = %f" % mol1, mol2, RMSD) 155 | print("% s, % s,% 5.3f" % (mol1, mol2, RMSD)) 156 | 157 | # make the alignment OBVIOUS 158 | cmd.hide("everything") 159 | cmd.show("ribbon", sel1 + " or " + sel2) 160 | cmd.color("gray70", mol1 ) 161 | cmd.color("magenta", mol2 ) 162 | cmd.color("red", "visible") 163 | cmd.show("ribbon", "not visible") 164 | cmd.center("visible") 165 | cmd.orient() 166 | cmd.zoom("visible") 167 | $0 168 | --------------------------------------------------------------------------------