Measuring the distance between residues and a surface

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@cd|:lys@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

Hi Julian, If you run your Chimera script from the shell command-line $ chimera --nogui distances.py then the reply log output goes to the shell. If you want instead to get the values in Python to do other things with them the Python code that implements the "measure distance" command is in chimera/share/Measure/measure.py python function distance(). Unfortunately it just reports values to the reply log. It would take some changes to try to get the values in Python. Not sure why you are measuring atom distance to a solvent excluded surface. If the atom is on the surface then the distance will be the atom radius. If you are trying to find which atoms are on the surface, a more common way to do that is to look at the surface area per atom (or per residue), and ones with non-zero area are on the surface. Tom
On Jul 25, 2019, at 11:23 AM, Stanley, Julian A <Julian_Stanley@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@cd|:lys@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 <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 _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>

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... <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/frameatom_spec.html> So your command could be something like measure dist :arg@cd|:lys@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: <http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html> ...but maybe the “ReadStdin” tool would be of interest, see: <http://www.rbvi.ucsf.edu/chimera/docs/ContributedSoftware/readstdin/readstdin.html> 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: <http://www.rbvi.ucsf.edu/chimera/docs/feedback.html> I hope this helps, Elaine ----- 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@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@cd|:lys@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
participants (3)
-
Elaine Meng
-
Stanley, Julian A
-
Tom Goddard