[Chimera-users] Programmer's Guide feedback....

Will Moore will at lifesci.dundee.ac.uk
Mon Dec 14 08:36:50 PST 2009


Hi,

  I am just trying to get started coding some plugins to Chimera, by  
following the Programmer's Guide 1.3.
I have limited programming experience, and the points below were where  
I got stuck... Not sure if the guide is generally aimed at those with  
more or less developer skills?


Starting with the examples (writeMol2.py) it isn't clear that all  
these commands should be typed in the IDLE window.
I see that it is mentioned previously in the text, but it would be  
helpful to make clear that this is not in the command line or python  
prompt.

When you've downloaded 4fun.pdb and saved it somewhere, does it matter  
where you save it, and how should you specify this in commands like
opened = chimera.openModels.open('4fun.pdb')

E.g. this would have made it more clear that you don't just put the  
file in a particular place that Chimera knows were to look:
opened = chimera.openModels.open('Users/username/Downloads/4fun.pdb')

Actually, this point was more relevant to the command:
execfile("backbone.py")

which I was working on earlier. I was trying to save backbone.py in  
one of the Chimera.app/Contents/Resources folders, and hoping that  
Chimera would find it with the above command:
When really the command should be more like:
execfile("Users/username/Desktop/backbone.py")


Running chimera from the command line:
A note that it is necessary to add the Chimera bin to the PATH  
variable would have been handy, especially for novice developers.
export PATH=$PATH:/Applications/Chimera.app/Contents/Resources/bin/


ToolbarButton.py
I got errors when running this script unless I put the import  
statements in the mainchain function like this


import os
import chimera

def mainchain():
	import re
	import chimera
	MAINCHAIN = re.compile("^(N|CA|C)$", re.I)
	for m in chimera.openModels.list(modelTypes=[chimera.Molecule]):
		for a in m.atoms:
			a.display = MAINCHAIN.match(a.name) != None
			
			
chimera.tkgui.app.toolbar.add('ToolbarButton.tiff', mainchain, 'Show  
Main Chain',
None)


Otherwise I got errors like:

Traceback (most recent call last):
   File "/Applications/Chimera.app/Contents/Resources/share/ 
__main__.py", line 65, in <module>
     value = chimeraInit.init(sys.argv)
   File "/Applications/Chimera.app/Contents/Resources/share/ 
chimeraInit.py", line 434, in init
     tkgui.eventLoop()
   File "/Applications/Chimera.app/Contents/Resources/share/chimera/ 
tkgui.py", line 2885, in eventLoop
     app.mainloop()
   File "/Applications/Chimera.app/Contents/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", line  
1023, in mainloop
     self.tk.mainloop(n)
   File "/Applications/Chimera.app/Contents/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/site-packages/Pmw/Pmw_1_3/ 
lib/PmwBase.py", line 1747, in __call__
     return apply(self.func, args)
   File "/Applications/Chimera.app/Contents/Resources/share/chimera/ 
toolbar.py", line 191, in <lambda>
     command=lambda func=callback: _guard(func))
   File "/Applications/Chimera.app/Contents/Resources/share/chimera/ 
toolbar.py", line 28, in _guard
     func()
   File "ToolbarButton.py", line 8, in mainchain
     MAINCHAIN = re.compile("^(N|CA|C)$", re.I)
NameError: global name 're' is not defined
Error in toolbar callback:
NameError: global name 're' is not defined
(see reply log for Python traceback info)



This is just my feedback, which I hope is useful

Cheers,

   Will. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20091214/cb78ff5a/attachment.html>


More information about the Chimera-users mailing list