This is a read-only mirror of


From PyMOL Wiki
Revision as of 04:10, 29 February 2008 by Gilleain (talk | contribs)
Jump to navigation Jump to search

Thanks to scripts found here; --Dan 07:44, 20 February 2008 (CST)

I altered this slightly, but I didn't want to just replace the code (it uses a nested function, which isn't great, but makes some things clearer, I think):

selectionMap = {
                "water" : "r. hoh",
                "protein" : "all and not hetatm",
                "ligand" : "organic"

def processSelection(selection):
    if selection in selectionMap:
        print "selecting '%s' = '%s'" % (selection, selectionMap[selection])
        return selectionMap[selection]
        return selection
def rselect(selection):"_selection", processSelection(selection))
cmd.extend("rselect", rselect)

def displayFunctionGenerator(representation, rasmolName=None):
    if rasmolName is not None:
        representation = rasmolName
    def innerFunction(arg=None):
        if arg == 'off':
            cmd.hide(representation, "_selection")
        elif arg is None:
  , "_selection")
    return innerFunction

def makeDisplayFunction(representation, rasmolName=None):
    cmd.extend(representation, displayFunctionGenerator(representation, rasmolName))

makeDisplayFunction("spacefill", "spheres")
makeDisplayFunction("wireframe", "lines")

cmd.alias("quit", "exit")
cmd.alias("zap", "delete all")

--Gilleain 22:10, 28 February 2008 (CST)