[chimera-dev] Getting distance values from runCommand
Tom Goddard
goddard at sonic.net
Mon Nov 17 15:27:42 PST 2014
Hi Alex,
The “measure distance” code is the measure() function in
chimera/share/Measure/measure.py
It handles distances between atoms and also surfaces and can handle multiple distance calculations and prints the result but unfortunately does not return it as a Python value. I’ve attached some Python code to find the minimum distance between two sets of atoms.
Unfortunately the Chimera Python programming interface is not documented. The programmer’s guide on the Chimera web side documentation page may be of some use, especially the examples,
http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html
and also the Chimera Python scripts on the Chimera developer web site can be of some use
http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts
Many of the simpler Chimera commands are in
chimera/share/Midas/__init__.py
To find others you can search all the Python under chimera/share for “addCommand(“ (for example on Linux or Mac shell command find . -type f -exec grep -nH -e "addCommand(" {} +) giving the attached file of command names and modules where the code is located.
In our next generation Chimera we are making full reference documentation for Python programming.
Tom
On Nov 15, 2014, at 4:17 AM, Alex Voronov wrote:
> Hi Tom,
>
> Thanks a lot for your reply!
>
> I actually need to use both... I use 'distance' to measure the distance between two points representing centers of mass. And I use 'measure distance' to measure the distance between an atom and a molecule. (I also use 'measure center ... mark true' to get the points of centers of mass, but I do not necessarily need the result in Python).
>
> Thanks for the Python command for 'distance'! Could you also point me to the command for 'measure distance'? Is there a way to find Python alternatives for an arbitrary Chimera commands?
>
> Thanks!
>
> Alex
>
>
> On 14 November 2014 02:40, Tom Goddard <goddard at sonic.net> wrote:
> Sure here is the distance between two atoms.
>
> import Midas
> d = Midas.distance('#1:395.A at CA #0:29.F at CA’)
>
> I don’t know what you are doing since “distance #1 #2” won’t work unless each of those models is only one atom. And of course “measure distance” is a different command and has a different Python call to access it. Please be specific about what you need. I don’t want to guess all the different possibilities of what you are trying to measure the distance between.
>
> Tom
>
>
>
> On Nov 12, 2014, at 12:41 PM, Alex Voronov wrote:
>
> > Hi,
> >
> > I'm measuring distance between two points. The measurement goes well and I get a correct value in the viewport. I would like to get the same value into a Python variable. Is it possible?
> >
> > I'm thinking about a code like this:
> >
> > d = chimera.runCommand('distance #1 #2')
> >
> > However, it seems to be impossible to get any value from runCommand, I always get None...
> >
> > Even parsing the log that appears in IDLE from commands 'distance #1 #2' or 'measure distance #1 #2' would sort-of work, but I don't know how to capture the log either...
> >
> > Is there a way to get values into variables from 'measure distance'?
> >
> > Thank you!
> >
> > Alex
> > _______________________________________________
> > Chimera-dev mailing list
> > Chimera-dev at cgl.ucsf.edu
> > http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20141117/323bcaad/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomdist.py
Type: text/x-python-script
Size: 482 bytes
Desc: not available
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20141117/323bcaad/attachment.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20141117/323bcaad/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: commands.txt
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20141117/323bcaad/attachment.txt>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20141117/323bcaad/attachment-0002.html>
More information about the Chimera-dev
mailing list