
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@uab.es

Hi JD, Many (all?) options are available from the Chimera command "findclash" itself, <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/findclash.html> for example "log true" to send information to the Reply Log or "saveFile pathname" to write it to a text file with location/name pathname. Is that what you needed, or does the information need to be stored in an array or variable? Best, Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html 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

Hi Elaine, Thanks a lot for the input. The thing is that I'd like to store the value in an array if it is possible. Cheers, JD -----Mensaje original----- De: Elaine Meng [mailto:meng@cgl.ucsf.edu] Enviado el: martes, 28 de octubre de 2008 17:29 Para: JeanDidier.Marechal@uab.es CC: chimera-dev@cgl.ucsf.edu Asunto: Re: [chimera-dev] python for finding clashes Hi JD, Many (all?) options are available from the Chimera command "findclash" itself, <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/findclash.html> for example "log true" to send information to the Reply Log or "saveFile pathname" to write it to a text file with location/name pathname. Is that what you needed, or does the information need to be stored in an array or variable? Best, Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html 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

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 Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu 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@uab.es
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Hi Eric and others, I am having problems with the selection, is it a list or a variable ? sorry. 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> clashes=detectClash(at.atoms()) AttributeError: 'list' object has no attribute 'atoms' I played around between list and variables but cant find the right way to move forward. Could you throw me a cable please . Best, jd De: Eric Pettersen [mailto:pett@cgl.ucsf.edu] Enviado el: martes, 28 de octubre de 2008 19:18 Para: JeanDidier.Marechal@uab.es CC: chimera-dev@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 Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu 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@uab.es _______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Hi JD, I misunderstood: I thought you meant that you had an actual Selection object you were working with. If what you have done is select the atoms you want to work with, then chimera.selection.currentAtoms() is, as you pointed out, a list of those atoms. Therefore you can just do this: clashes = detectClash(chimera.selection.currentAtoms()) --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On Oct 29, 2008, at 11:40 AM, Dr. Jean-Didier Maréchal wrote:
Hi Eric and others,
I am having problems with the selection, is it a list or a variable ? … sorry.
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> clashes=detectClash(at.atoms()) 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 .
Best, jd
De: Eric Pettersen [mailto:pett@cgl.ucsf.edu] Enviado el: martes, 28 de octubre de 2008 19:18 Para: JeanDidier.Marechal@uab.es CC: chimera-dev@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
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
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@uab.es
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
participants (4)
-
Dr. Jean-Didier Maréchal
-
Elaine Meng
-
Eric Pettersen
-
Jean Didier Pie Marechal