VisLoad

From PyMOLWiki
Revision as of 11:12, 16 March 2010 by Inchoate (talk | contribs) (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…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 string
import os
from os import path

def visLoad(filename, object=None, *args, **kwargs):
        if object==None:
                object = string.split(os.path.basename(filename),".")[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)

See Also

Load, Save, Show_as