#A* ------------------------------------------------------------------- #B* This file contains source code for the PyMOL computer program #C* Copyright (c) Schrodinger, LLC. #D* ------------------------------------------------------------------- #E* It is unlawful to modify or remove this copyright notice. #F* ------------------------------------------------------------------- #G* Please see the accompanying LICENSE file for further information. #H* ------------------------------------------------------------------- #I* Additional authors of this source file include: #-* #-* #-* #Z* ------------------------------------------------------------------- if True: cmd = __import__("sys").modules["pymol.cmd"] import pymol from pymol import CmdException from .cmd import DEFAULT_ERROR, DEFAULT_SUCCESS, _raising, is_ok, is_error def show_help(cmmd, *, _self=cmd): # INTERNAL print("PyMOL>help %s" % cmmd) help(cmmd) if _self.get_setting_int("internal_feedback") > 0: print("(Hit ESC to hide)") def python_help(string, *, _self=cmd): r''' DESCRIPTION You have asked for help on a Python keyword which is available from within the PyMOL command language. Please consult the official Python documentation at http://www.python.org for detailed information on Python keywords. You may include Python blocks in your PyMOL command scripts, but do note that multi-line blocks of Python in PyMOL command files will require explicit continuation syntax in order to execute properly (see below). Generally, if you want to write Python block which span multiple lines, you will want to use ".py" file, and then use "extend" in order to expose your new code to the PyMOL command language. This will give you better error checking and more predictable results. EXAMPLES a=1 while a<10: \ print a \ a=a+1 SEE ALSO extend, run, @ ''' return python(string, _self=_self) def help(command= "commands", *, _self=cmd): ''' DESCRIPTION "help" prints out the online help for a given command. USAGE help command ''' import textwrap r = DEFAULT_SUCCESS cmmd = _self.help_sc.auto_err(command,'topic') if cmmd in _self.keyword: doc = _self.keyword[cmmd][0].__doc__ elif cmmd in _self.help_only: doc = _self.help_only[cmmd][0].__doc__ else: print("Error: unrecognized command") return r if doc: print("\n" + textwrap.dedent(doc).strip() + "\n") else: print("Error: sorry no help available on that command.") return r def help_setting(name, quiet=1, *, _self=cmd): ''' DESCRIPTION Print documentation for a setting. USAGE help_setting name ''' raise pymol.IncentiveOnlyException() def commands(): ''' COMMANDS INPUT/OUTPUT load save delete quit VIEW turn move clip rock show hide enable disable reset refresh rebuild zoom origin orient view get_view set_view MOVIES mplay mstop mset mdo mpng mmatrix frame rewind middle ending forward backward IMAGING png mpng RAY TRACING ray MAPS isomesh isodot DISPLAY cls viewport splash SELECTIONS select mask SETTINGS set button ATOMS alter alter_state EDITING create replace remove h_fill remove_picked edit bond unbond h_add fuse undo redo protect cycle_valence attach FITTING fit rms rms_cur pair_fit intra_fit intra_rms intra_rms_cur COLORS color set_color HELP help commands DISTANCES dist STEREO stereo SYMMETRY symexp SCRIPTS @ run LANGUAGE alias extend Try "help ". Also see the following extra topics: "api", "editing", "edit_keys", "examples", "faster", "keyboard", "launching", "mouse", "movies", "python", "povray", "release", "selections", "skip", "sync", "stereochemistry", "text_type", "transparency", "@". ''' _self.help('commands') def editing(*, _self=cmd): ''' SUMMARY PyMOL has a rudimentary, but quite functional molecular structure editing capability. However, you will need to use an external mimizer to "clean-up" your structures after editing. Furthermore, if you are going to modify molecules other than proteins, then you will also need a way of assigning atom types on the fly. To edit a conformation or structure, you first need to enter editing mode (see Mouse Menu). Then you can pick an atom (CTRL-Middle click) or a bond (CTRL-Right click). Next, you can use the other CTRL-key/click combinations listed on the right hand side of the screen to adjust the attached fragments. For example, CTRL-left click will move fragments about the selected torsion. Editing structures is done through a series of CTRL key actions applied to the currently selected atom or bonds. See "help edit_keys" for the exact combinations. To build structures, you usually just replace hydrogens with methyl groups, etc., and then repeat. They are no short-cuts currently available for building common groups, but that is planned for later versions. NOTE Only "lines" and "sticks" representations can be picked using the mouse, however other representations will not interfere with picking so long as one of these representation is present underneath. ''' _self.help('editing') def release(*, _self=cmd): ''' RELEASE NOTES PyMOL is a free, open, and expandable molecular graphics system written by computational scientists to enable molecular modeling from directly within Python. It will be of most benefit to hybrid scientist/developers in the fields of structural biology, computational chemistry, and informatics who seek an open and unrestricted visualization tool for interfacing with their own programs. PyMOL will also be of benefit to advanced non-developers familiar with similar programs such as Midas, O, Grasp, X-PLOR and CNS. PyMOL currently includes a diverse command language, a powerful application programmers interface (API), and a variety of mouse and keyboard driven functionality for viewing, animation, rendering, and molecular editing. A partial manual is now available on the web. Two external GUI development options are supported for PyMOL: "Tkinter" and "wxPython". Developers can take their pick. Note that only Tkinter is supported under Windows with the default PyMOL and Python distributions, so for maximum ease of installation under Windows, stick with Tkinter (Tcl/Tk). For this reason, the Tkinter-based GUI is going to be the default GUI for standard PyMOL despite its drawbacks. Warren L. DeLano (5/1/2001), warren@delanoscientific.com Jason Vertrees (3/7/2011), jason.vertrees@schrodinger.com (update) ''' _self.help('release') def edit_keys(*, _self=cmd): ''' EDITING KEYS These are defaults, which can be redefined. Note that while entering text on the command line, some of these control keys take on text editing functions instead (CTRL - A, E, and K, and DELETE), so you should clear the command line before trying to edit atoms. ATOM REPLACEMENT CTRL-C Replace picked atom with carbon (C) CTRL-N Replace picked atom with nitrogen (N) CTRL-O Replace picked atom with oxygen (O) CTRL-S Replace picked atom with sulpher (S) CTRL-G Replace picked atom with hydrogen (H) CTRL-F Replace picked atom with fluorene (F) CTRL-L Replace picked atom with chlorine (Cl) CTRL-B Replace picked atom with bromine (Br) CTRL-I Replace picked atom with iodine (I) ATOM MODIFICATION CTRL-J Set charge on picked atom to -1 CTRL-K Set charge on picked atom to +1 CTRL-D Remove atom or bond (DELETE works too). CTRL-Y Add a hydrogen to the current atom CTRL-R Adjust hydrogens on atom/bond to match valence. CTRL-E Inverts the picked stereo center, but you must first indicate the constant portions with the (lb) and (rb) selections. CTRL-T Connect atoms in the (lb) and (rb) selections. CTRL-W Cycle the bond valence on the picked bond. UNDO and REDO of conformational changes (not atom changes!) CTRL-Z undo the previous conformational change. (you can not currently undo atom modifications). CTRL-A redo the previous conformational change. ''' _self.help('edit_keys') def at_sign(*, _self=cmd): ''' DESCRIPTION "@" sources a PyMOL command script as if all of the commands in the file were typed into the PyMOL command line. USAGE @ PYMOL API Not directly available. Instead, use cmd.do("@..."). ''' _self.help(at_sign) def api(name, *, _self=cmd): ''' DESCRIPTION API helper function. Get the full function name (incl. module) of given command. ARGUMENTS name = string: name of a PyMOL command NOTES The PyMOL Python Application Programming Interface (API) should be accessed exclusively through the "cmd" module (never "_cmd"!). Nearly all command-line functions have a corresponding API method. from pymol import cmd result = cmd.( argument , ... ) Although the PyMOL core is not multi-threaded, the API is thread-safe and can be called asynchronously by external python programs. PyMOL handles the necessary locking to insure that internal states do not get corrupted. This makes it very easy to build complicated systems which involve direct realtime visualization. ''' import sys name = _self.kwhash.auto_err(name, 'command') func = cmd.keyword[name][0] print(' CMD:', name) print(' API: %s.%s' % (func.__module__, func.__name__)) if func == getattr(_self, func.__name__, None): print(' API: cmd.' + func.__name__) print(' FILE:', sys.modules[func.__module__].__file__) return func def keyboard(*, _self=cmd): ''' KEYBOARD COMMANDS and MODIFIERS ESC Toggle onscreen text. INSERT Toggle rocking. LEFT ARROW, RIGHT ARROW Go backward or forward one frame, or when editing, go forward or back one character. HOME, END Go to the beginning or end of a movie. Command Entry Field in the Interal GUI (black window) If text exists on the command line then control keys correspond to editing the command line: TAB Complete commmand or filename (like in tcsh or bash). CTRL-A Go to the beginning of the line. CTRL-E Go to the end of the line. CTRL-K Delete through to the end of the line. CTRL-V Paste into command line (operating system dependent.) If no text is on the command line, then control keys correspond to molecular editing: Command Entry Field on the External GUI (gray window). CTRL-A Select all atoms into the named selection "(sele)". CTRL-C Copy current selection. CTRL-I Invert currently active selection. CTRL-V Paste copied or cut atoms into a new object. CTRL-X Cut the selected atoms. CTRL-Y Redo. CTRL-Z Undo. EDITING type "help edit_keys" for keyboard shortcuts used in editing. ''' _self.help('keyboard') def transparency(*, _self=cmd): ''' TRANSPARENCY As of version 0.68, trasparent surfaces are supported in both realtime (OpenGL) rendering mode as well as with ray-traced images. Transparency is currently managed by setting either the global transparency variable or one attached to an individual molecule object. It isn't yet possible to control transparency on a per-atom basis. EXAMPLES set transparency=0.5 # makes all surfaces 50% transparent set transparency=0.5, mol3 # makes only mol3's surface transparent ''' cmd.help('transparency') def mouse(): ''' MOUSE CONTROLS The configuration can be changed using the "Mouse" menu. The current configuration is described on screen with a small matrix on the lower right hand corner, using the following abbreviations: Buttons (Horizontal Axis) L = left mouse click M = middle mouse click R = right mouse click Modifiers (Veritical axis on the matrix) None = no keys held down while clicking Shft = hold SHIFT down while clicking Ctrl = hold CTRL down while clicking CtSh = hold both SHIFT and CTRL down while clicking Visualization Functions Rota = Rotates camera about X, Y, and Z axes RotZ = Rotates camera about the Z axis Move = Translates along the X and Y axes MovZ = Translates along Z axis Clip = Y motion moves the near clipping plane while PkAt = Pick an atom PkBd = Pick a bond Orig = Move origin to selected atom +lb = Add an atom into the (lb) selection lb = Define the (lb) selection with the indicated atom. rb = Define the (rb) selection with the indicated atom. Editing Functions RotF = Rotate fragment MovF = Move fragment TorF = Torsion fragment ''' _self.help('mouse') def examples(*, _self=cmd): ''' EXAMPLE ATOM SELECTIONS select bk = ( name CA or name C or name N ) * can be abbreviated as * sel bk = (n;CA,C,N) select hev = ( not hydro ) * can be abbreviated as * sel hev = (!h;) select site = ( byres ( resi 45:52 expand 5 )) * can be abbreviated as * sel site = (b;(i;45:52 x;5)) select combi = ( hev and not site ) * can be abbreviated as * sel combi = (hev&!site) ''' _self.help('examples') def launching(*, _self=cmd): ''' PyMOL COMMAND LINE OPTIONS -c Command line mode, no GUI. For batch opeations. -i Disable the internal OpenGL GUI (object list, menus, etc.) -x Disable the external GUI module. -t Use Tcl/Tk based external GUI module (pmg_tk). -q Quiet launch. Suppress splash screen & other chatter. -p Listen for commands on standard input. -e Start in full-screen mode. -2 Start in two-button mouse mode. -o Disable security protections for session files. -R Launch Greg Landrum's XMLRPC listener. -B Enable blue-line stereo signal (for Mac stereo) -G Start in Game mode. -S Force and launch in stereo, if possible. -M Force mono even when hardware stereo is present. -X -Y -W -H -V Adjust window geometry. -f <# line> Controls display of commands and feedback in OpenGL (0=off). -r Run a Python program (in __main__) on startup. -l Spawn a python program in new thread. -d Run pymol command string upon startup. -u