Get value of 'measure distance' command

Hi, I need to calculate the minimum distance between 2 residues but It seems that I can't find the correct way to use the 'measure distance' command in python script. I tried: import Measure temp = Measure.measure_command('distance', 'distance :628.a :20.b') but it gave me the error: "No target atoms or surface" Can you please precise the correct syntax of this command? Thank you! Thu

Hi Thu, If you know the correct Chimera command, then you could just use runCommand in python, as explained in this page: <http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html> I don't know python, but as for the Chimera "distance" command, it requires exactly two atoms (not two sets of atoms), e.g. distance :628.a@ca :20.b@ca However, in our list of python scripts for Chimera, I see there is already a script to find the minimum distance between two sets of atoms! You can get this script "atomdist.py" from: <http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts> I hope this helps, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco On Mar 24, 2015, at 6:20 AM, Hoai Thu NGUYEN <hoaithu.nguyen.26.4.92@gmail.com> wrote:
Hi, I need to calculate the minimum distance between 2 residues but It seems that I can't find the correct way to use the 'measure distance' command in python script. I tried:
import Measure
temp = Measure.measure_command('distance', 'distance :628.a :20.b')
but it gave me the error: "No target atoms or surface"
Can you please precise the correct syntax of this command? Thank you! Thu

Your Python code works for me. (I tried “open 1a0m”, then Measure.measure_command(‘distance’, 'distance :10.A :10.B’)). So I guess your residue specifiers :628.a or :20.b really don’t refer to any atoms. But the command does not return the distance value so this won’t help you get the value and it is probably easiest to use the atomdist.py script that Elaine mentioned. Tom
On Mar 24, 2015, at 9:56 AM, Elaine Meng <meng@cgl.ucsf.edu> wrote:
Hi Thu, If you know the correct Chimera command, then you could just use runCommand in python, as explained in this page:
<http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html>
I don't know python, but as for the Chimera "distance" command, it requires exactly two atoms (not two sets of atoms), e.g.
distance :628.a@ca :20.b@ca
However, in our list of python scripts for Chimera, I see there is already a script to find the minimum distance between two sets of atoms! You can get this script "atomdist.py" from:
<http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts>
I hope this helps, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
On Mar 24, 2015, at 6:20 AM, Hoai Thu NGUYEN <hoaithu.nguyen.26.4.92@gmail.com> wrote:
Hi, I need to calculate the minimum distance between 2 residues but It seems that I can't find the correct way to use the 'measure distance' command in python script. I tried:
import Measure
temp = Measure.measure_command('distance', 'distance :628.a :20.b')
but it gave me the error: "No target atoms or surface"
Can you please precise the correct syntax of this command? Thank you! Thu
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Oops, I forgot that (unlike "distance") the Chimera command "measure distance" accepts two sets of atoms. In that case, you could first figure out the necessary Chimera command (for example, by entering it in the command line) and then embed it into python with runCommand: from chimera import runCommand runCommand("measure distance :628.a :20.b") <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/measure.html#distance> <http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html> Sorry about that, Elaine On Mar 24, 2015, at 9:56 AM, Elaine Meng <meng@cgl.ucsf.edu> wrote:
Hi Thu, If you know the correct Chimera command, then you could just use runCommand in python, as explained in this page:
<http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html>
I don't know python, but as for the Chimera "distance" command, it requires exactly two atoms (not two sets of atoms), e.g.
distance :628.a@ca :20.b@ca
However, in our list of python scripts for Chimera, I see there is already a script to find the minimum distance between two sets of atoms! You can get this script "atomdist.py" from:
<http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts>
I hope this helps, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
On Mar 24, 2015, at 6:20 AM, Hoai Thu NGUYEN <hoaithu.nguyen.26.4.92@gmail.com> wrote:
Hi, I need to calculate the minimum distance between 2 residues but It seems that I can't find the correct way to use the 'measure distance' command in python script. I tried:
import Measure
temp = Measure.measure_command('distance', 'distance :628.a :20.b')
but it gave me the error: "No target atoms or surface"
Can you please precise the correct syntax of this command? Thank you! Thu
participants (3)
-
Elaine Meng
-
Hoai Thu NGUYEN
-
Tom Goddard