[chimera-dev] python for finding clashes

Eric Pettersen pett at cgl.ucsf.edu
Tue Oct 28 11:17:45 PDT 2008

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 findclash).
> All the best,
> JD
> Dr. Jean-Didier Maréchal
> Lecturer
> 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
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev

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

More information about the Chimera-dev mailing list