[chimera-dev] python for finding clashes

Dr. Jean-Didier Maréchal jeandidier.marechal at gmail.com
Wed Oct 29 11:40:02 PDT 2008

Hi Eric and others,


I am having problems with the selection, is it a list or a variable ?




I selected some atoms and then open the IDLE.


Then goes the script :

>> import chimera

>>> from DetectClash import detectClash

>>> at=chimera.selection.currentAtoms() – this stocks in at a list of atoms.

>>> clashes=detectClash(at.atoms()) – I do what you say


And the message error :

Traceback (most recent call last):

  File "<pyshell#3>", line 1, in <module>


AttributeError: 'list' object has no attribute 'atoms'


I played around between list and variables but can’t find the right way to
move forward. Could you throw me a cable please .





De: Eric Pettersen [mailto:pett at cgl.ucsf.edu] 
Enviado el: martes, 28 de octubre de 2008 19:18
Para: JeanDidier.Marechal at uab.es
CC: chimera-dev at cgl.ucsf.edu
Asunto: Re: [chimera-dev] python for finding clashes


Hi JD,

            You should use DetectClash.detectClash().  The only mandatory
argument is a list of atoms.  So if your selection was in a variable named
's', you might call the function like so:


            from DetectClash import detectClash

            clashes = detectClash(s.atoms())


The return value is a dictionary.  The keys of the dictionary are atoms that
have clashes.  The values are dictionaries.  These dictionaries have keys
which are the atoms that clash with the original key atom.  The values are
the amount of the clash.  So to get the number of clashes, you would use
something like this:


            sum = 0

            for clashDict in clashes.values():

                        sum += len(clashDict)

            numClashes = sum / 2


            Now, there are a lot of optional keyword arguments to the
detectClash() function.  They are pretty well documented in the doc string
of the function.  So you should look through the doc string and post any
questions that you might still have...




                        Eric Pettersen

                        UCSF Computer Graphics Lab




On Oct 28, 2008, at 7:15 AM, Jean Didier Pie Marechal wrote:

Hi everyone,

I am writing a script for which I need the number of clashes for a given
selection for continuing. 

My first thought was to simply run in my script: 
runCommand("findclash selection ignoreIntraRes false") 
after having selected the region I was interested in.
However, I realize that I come to the recurrent problem: having the
information I am interested in printed in the reply log. I don't know how to
have the info passed into an array or any kind of variable in the  python
environment. Could you tell me how to do so please? 

On the other side, I would be pleased if you could tell me what is the
correct arguments I have to pass and syntax I have to use for the functions
detectClash and/or cmdDetectClash (which I guess is the basis of the same

All the best,

Dr. Jean-Didier Maréchal
Computational Bioorganic and Bioionorganic Chemistry @ Transmet
Unitat de Química Física
Departament de Química
Universitat Autònoma de Barcelona
Edifici C.n.
08193 Cerdanyola (Barcelona)
Tel: +34.935814936
e-mail: JeanDidier.Marechal at uab.es

Chimera-dev mailing list
Chimera-dev at cgl.ucsf.edu


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20081029/ca74ba76/attachment.html>

More information about the Chimera-dev mailing list