I would like to create a module for pymol which accepts several selections for processing. The number of selections passed to the modules is not fixed and thus I want to pass a list of selections into the applications. I have tried something like the following.
from pymol import cmd, stored, CmdException class Helix(object): def __init__(self): self.selection = None def my_module(*selections): helices = [Helix() for x in selections] for helix, sele in zip(helices, selections): helix.selection = sele """ Do some more things with these selections""" Within pymol I load it up and import the module without any trouble. I make several selections and try to pass them in as follows. sele S1, resi 1-10 sele S2, resi 11-15 sele S3, resi 16-30 import my_module my_module S1, S2, S3 I receive the following error Traceback (most recent call last): File "/Volumes/Data/scm/vikki/bld/MacPyMOL.app/pymol/modules/pymol/parser.py", line 254, in parse TypeError: my_module() got an unexpected keyword argument '_self' I have tried modifying the code as follows. def my_module(selections): ... I get an error that my_module expects only one argument. It has been suggested that I pass a list of strings and then access the selections based on the string name of the selections, however, I have not been able to find the syntax to put this into the code. Thanks. David ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net