[Chimera-users] Measuring the distance between residues and a surface

Elaine Meng meng at cgl.ucsf.edu
Thu Jul 25 12:36:42 PDT 2019

Hi Julian,
You can specify surface-only of #0 (without selection) in the command line with this trickery:  #0&~@* 

Although it looks like cartoon cursing, it means “model 0 AND NOT atom of any name”  :-)

Command-line specifiation is described here, but I had to try the above to make sure it actually worked...

So your command could be something like

measure dist :arg at cd|:lys at ce #0&~@* mult t

When I tried this, I saw mostly 1.88 ( = VDW radius of the Lys CE atom) meaning it was right at the solvent-excluded surface.

You could save Reply Log contents to a file with python as explained at the bottom of this page:

...but maybe the “ReadStdin” tool would be of interest, see:

I mostly work on ChimeraX these days (that is where the new developments are going), so I’d forgotten the name of this tool and just looked through the tools index to find it.  Besides just looking through the command index and tools index of the User Guide, you can use menu: Help… Search Documentation to look for specific terms, and search the archive here:

I hope this helps,
Elaine C. Meng, Ph.D.
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Jul 25, 2019, at 11:23 AM, Stanley, Julian A <Julian_Stanley at hms.harvard.edu> wrote:
> Hello! I'm fairly new to Chimera, so if you're able to point me towards any resources that can help me answer questions like this one independently in the future, please do!
> Here's the question:
> I would like to measure the distance between the ends arginine and lysine residues and a surface, using Chimera's python modules.
> Typically, I would load my .pdb file, generate a surface, and then use the "measure distance" command and parse the output from the Reply Log. 
> This approach works fine, except since "measure distance" prints to the reply log, I need to run my script in GUI mode. If possible, I'd prefer to run everything from the command line only. I thought that I might be able to do this with the distance() command, but I can't figure out how to pass a surface to that command. Does anyone have any tips/advice?
> In summary, what I usually do:
> ```
> from chimera import runCommand as rc
> # load the file
> rc("open " + pdbFile)
> # Generate a surface
> rc("select protein")
> rc("split")
> rc("surface allComponents false")
> rc("~select")
> # Measure distance between arg and lys and the surface
> rc("select #0")
> rc("~select #0:@")
> rc("measure distance :arg at cd|:lys at ce selection multiple true show true")
> ```
> And then I parse out the distances from the Reply Log.
> What I would prefer to do:
> It would be better to have the output to go to STDOUT when I run the script.
> I imagine that I'd use something like the `distance()` command, of the premade scripts (like here: http://plato.cgl.ucsf.edu/trac/chimera/attachment/wiki/Scripts/atomdist.py) but they are designed to measure the distance between atoms or residues, not between residues and a surface. 
> Thanks for your help!
> Sincerely,
> Julian

More information about the Chimera-users mailing list