Stephen, You're looking for the PyMOL API function "extend":
from pymol import cmd cmd.extend("ramp_colors",ramp_chain.ramp_colors) Would then permit the following: ramp_colors chain A See "help extend" for more info... Cheers, Warren -- mailto:war...@sunesis.com Warren L. DeLano, Ph.D. Informatics Manager Sunesis Pharmaceuticals, Inc. 341 Oyster Point Blvd. S. San Francisco, CA 94080 (650)-266-3606 FAX:(650)-266-3501 > -----Original Message----- > From: Stephen Graham [mailto:steph...@usyd.edu.au] > Sent: Tuesday, January 07, 2003 4:14 PM > To: pymol-users@lists.sourceforge.net > Subject: [PyMOL] "Rolling your own" functions in PyMol > > > Hi All, > > I am a recent subscriber to the list, so apologies if this > question has > been answered before. I am interested in finding out how you can add > your own functions to PyMol such that they may be > "transparently" called > from inside PyMol's shell. The the basic question is "How do > I register > PyMol names for home-grown functions so that they can be used like the > functions in the util module". A more detailed example of what I am > after is below. Also, are there any warehouses or collections of > home-grown functions to which I could submit functions I > write and from > which I could gain examples from other users? > > Cheers > > Stephen > > == More detailed description of my problem == > > I have written a function to ramp coloring of a backbone > between two or > more arbitrary colors (it is really a generalization of the code in > util.rainbow). I have imported the code using the general > Python import > command: > import ramp_chain > Now, let's say that I have a selection object defined as: > select A,(chain A) > Were I using the rainbow command I would be able to issue the command: > util.rainbow A > Which follows the general rules of command line parsing. > Unfortunately, > in my case issuing the command: > ramp_chain.ramp_colors A > gives the error: > Syntax error: unexpected EOF (and there is an arrow under the letter > A). > I *can* call the command using the syntax: > ramp_chain.ramp_colors( "chain A" ) > but this syntax is not optimal - I would like to be able to use my > already defined selections. > > -- > Stephen Graham > PhD candidate and nasty sysadmin > Crystallography Group > School of Molecular and Microbial Biosciences > Building G08 > University of Sydney > New South Wales, 2006 > Australia > Ph: +61 2 9351 8197 > Fax: +61 2 9351 4726 > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pymol-users >