VisLoad: Difference between revisions
Jump to navigation
Jump to search
(Created page with 'visLoad will load an object and show it in your desired representation. PyMOL by default loads things as lines (or spheres, a setting you may change), but not others. = Usa…') |
mNo edit summary |
||
Line 9: | Line 9: | ||
= The Code = | = The Code = | ||
<source lang="python"> | <source lang="python"> | ||
import os | import os | ||
from os import path | from os import path | ||
Line 15: | Line 14: | ||
def visLoad(filename, object=None, *args, **kwargs): | def visLoad(filename, object=None, *args, **kwargs): | ||
if object==None: | if object==None: | ||
object = | object = os.path.basename(filename).split(".")[0] | ||
cmd.set("suspend_updates") | cmd.set("suspend_updates") | ||
try: | try: |
Revision as of 03:18, 19 May 2011
visLoad will load an object and show it in your desired representation. PyMOL by default loads things as lines (or spheres, a setting you may change), but not others.
Usage
- Save the code to "visLoad.py".
- Run the code from PyMOL or put it in your .pymolrc
- Use visLoad whenever you would use load
- To change representations, update "cartoon" to something else, or add more intermediate commands.
The Code
import os
from os import path
def visLoad(filename, object=None, *args, **kwargs):
if object==None:
object = os.path.basename(filename).split(".")[0]
cmd.set("suspend_updates")
try:
cmd.load(filename, object, *args, **kwargs)
cmd.show_as("cartoon", object)
finally:
cmd.set("suspend_updates", "off")
cmd.extend("visLoad", visLoad)