
Dear Friends, Is there any way to display weighted distance in chimera. For example, in the attached data file, we have distance in column 1 and its corresponding importance in column 2. What i would like to do is to load the structure, display the distance between two group of residues and adjust the width of the line (created by distance monitor) according to the importance of the distance in the data file. Thank you, Baa

Hi Bala, If these were atom-associated values, you could make your own custom attribute and then easily color or scale the atoms by the values. However, these are values associated with distance measurements, and we don't have a similarly nice mechanism for assigning attributes to bonds or pseudobonds. Another point is that all pseudobonds in a group (such as all distance monitors) have the same linewidth. Instead of different linewidths, you could show them with different colors and/or as sticks of different widths. With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1 However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance. Another possibility instead of making distance monitors is to make custom pseudobonds with the Pseudobond Reader tool, which reads a file with lines like: #0:22.a@oe2:25@ne hot pink <http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/pbreader/pbreader.h...
but that does not get you any farther than the distance monitor approach, as you would still need to conditionally set color (which can be done in the input file) or radius (with "setattr" as above) depending on the distance. 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 May 5, 2010, at 7:29 AM, Bala subramanian wrote:
Dear Friends, Is there any way to display weighted distance in chimera. For example, in the attached data file, we have distance in column 1 and its corresponding importance in column 2. What i would like to do is to load the structure, display the distance between two group of residues and adjust the width of the line (created by distance monitor) according to the importance of the distance in the data file.
Thank you, Baa
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users

On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance- monitor pseudobond group in Chimera with: from StructureMeasure.DistMonitor import distanceMonitor and run through the distance-monitor pseudobonds with: for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()... --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu

Dear Elaine and Eric, Thanks for the inputs. I started the chimera interface and tried to use the StructureMeasure module using the IDLE that is present in chimera but it shows me import Error. I dnt understand why. I am using chimera 1.5 alpha version 29904. Do i need to set some path to use the module.
from StructureMeasure import * Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from StructureMeasure import * ImportError: No module named StructureMeasure
Bala On Wed, May 5, 2010 at 8:37 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance-monitor pseudobond group in Chimera with:
from StructureMeasure.DistMonitor import distanceMonitor
and run through the distance-monitor pseudobonds with:
for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()...
--Eric
Eric Pettersen
UCSF Computer Graphics Lab

Oops. The module name is "StructMeasure", not "StructureMeasure", so the correct line of Python would be: from StructMeasure.DistMonitor import distanceMonitor --Eric On May 10, 2010, at 3:36 AM, Bala subramanian wrote:
Dear Elaine and Eric, Thanks for the inputs. I started the chimera interface and tried to use the StructureMeasure module using the IDLE that is present in chimera but it shows me import Error. I dnt understand why. I am using chimera 1.5 alpha version 29904. Do i need to set some path to use the module.
from StructureMeasure import * Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from StructureMeasure import * ImportError: No module named StructureMeasure
Bala
On Wed, May 5, 2010 at 8:37 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote: On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance- monitor pseudobond group in Chimera with:
from StructureMeasure.DistMonitor import distanceMonitor
and run through the distance-monitor pseudobonds with:
for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()...
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu

Dear Eric and Elaine, *Thank you so much for your inputs*. I could implement the 'weighted distance' representation. I have certain queries. I would appreciate your inputs for the same. 1) When i type help(object) in chimera's python shell, it shows the help message, is there any to way to make the help information to be displayed in a separate window. I tried in config setting but i couldnt make it. 2) Is there any way to invoke chimera within normal python interpreter. I am able to do this for pymol. But i dnt know if i can do the same with chimera. I tried to set PYTHONPATH, but it vain. [cbala@RAMANA ~]$ python Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import pymol
3) In the following code, i am collecting Cbeta atoms from two groups of residues and calculating the cb-cb distance. If instead of Cbeta, i have to calculate the side chain COM-COM (center of mass) distance between two groups of residues, how can i do it or which module should i use. 4)What is the syntax to change the color of pseudobonds ? *I am pasting the script below so that it may be useful to someone who wants to do a similar thing. *
import chimera from StructMeasure.DistMonitor import *
model=chimera.openModels.open('trial.pdb') res=model[0].residues don_atom=[];acp_atom=[]
#collecting CB atoms of donor and acceptor residues
for x in res: if x.type in ['ARG','GLN']: don_atom.append(x.atomsMap['CB'][0]) elif x.type=='GLU': acp_atom.append(x.atomsMap['CB'][0]) else: continue
#open the distance weight data
weight={} for line in open('rad.dat'): line=line.split() weight[float(line[0])]=line[1]
b=[] #pseudo bond list
for v1 in don_atom: for v2 in acp_atom: b.append(distanceMonitor.newPseudoBond(v1,v2))
#changing pseudo bond features
for pb in b: pb.drawMode=1 chi=round(pb.length()) if chi in weight: pb.radius=float(weight[chi])
Thanks, Bala On Mon, May 10, 2010 at 8:07 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Oops. The module name is "StructMeasure", not "StructureMeasure", so the correct line of Python would be:
from StructMeasure.DistMonitor import distanceMonitor
--Eric
On May 10, 2010, at 3:36 AM, Bala subramanian wrote:
Dear Elaine and Eric, Thanks for the inputs. I started the chimera interface and tried to use the StructureMeasure module using the IDLE that is present in chimera but it shows me import Error. I dnt understand why. I am using chimera 1.5 alpha version 29904. Do i need to set some path to use the module.
from StructureMeasure import * Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from StructureMeasure import * ImportError: No module named StructureMeasure
Bala
On Wed, May 5, 2010 at 8:37 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance-monitor pseudobond group in Chimera with:
from StructureMeasure.DistMonitor import distanceMonitor
and run through the distance-monitor pseudobonds with:
for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()...
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu

Dear bala, to invoke chimera as a python module ( Question 2) you should execute the following steps: 1) Finding the root directory of the chimera installation (example:/usr/local/chimera ) 2) export LD_LIBRARY=/usr/local/chimera/lib:$LD_LIBRARY 3) export PYTHONPATH=/usr/local/chimera/lib:/usr/local/chimera/share:$PYTHONPATH The result is: oteri@priestley:~$ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import chimera
2010/5/18 Bala subramanian <bala.biophysics@gmail.com>
Dear Eric and Elaine,
*Thank you so much for your inputs*. I could implement the 'weighted distance' representation. I have certain queries. I would appreciate your inputs for the same.
1) When i type help(object) in chimera's python shell, it shows the help message, is there any to way to make the help information to be displayed in a separate window. I tried in config setting but i couldnt make it.
2) Is there any way to invoke chimera within normal python interpreter. I am able to do this for pymol. But i dnt know if i can do the same with chimera. I tried to set PYTHONPATH, but it vain.
[cbala@RAMANA ~]$ python Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import pymol
3) In the following code, i am collecting Cbeta atoms from two groups of residues and calculating the cb-cb distance. If instead of Cbeta, i have to calculate the side chain COM-COM (center of mass) distance between two groups of residues, how can i do it or which module should i use.
4)What is the syntax to change the color of pseudobonds ?
*I am pasting the script below so that it may be useful to someone who wants to do a similar thing. *
import chimera from StructMeasure.DistMonitor import *
model=chimera.openModels.open('trial.pdb') res=model[0].residues don_atom=[];acp_atom=[]
#collecting CB atoms of donor and acceptor residues
for x in res: if x.type in ['ARG','GLN']: don_atom.append(x.atomsMap['CB'][0]) elif x.type=='GLU': acp_atom.append(x.atomsMap['CB'][0]) else: continue
#open the distance weight data
weight={} for line in open('rad.dat'): line=line.split() weight[float(line[0])]=line[1]
b=[] #pseudo bond list
for v1 in don_atom: for v2 in acp_atom: b.append(distanceMonitor.newPseudoBond(v1,v2))
#changing pseudo bond features
for pb in b: pb.drawMode=1 chi=round(pb.length()) if chi in weight: pb.radius=float(weight[chi])
Thanks, Bala
On Mon, May 10, 2010 at 8:07 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Oops. The module name is "StructMeasure", not "StructureMeasure", so the correct line of Python would be:
from StructMeasure.DistMonitor import distanceMonitor
--Eric
On May 10, 2010, at 3:36 AM, Bala subramanian wrote:
Dear Elaine and Eric, Thanks for the inputs. I started the chimera interface and tried to use the StructureMeasure module using the IDLE that is present in chimera but it shows me import Error. I dnt understand why. I am using chimera 1.5 alpha version 29904. Do i need to set some path to use the module.
from StructureMeasure import * Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from StructureMeasure import * ImportError: No module named StructureMeasure
Bala
On Wed, May 5, 2010 at 8:37 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance-monitor pseudobond group in Chimera with:
from StructureMeasure.DistMonitor import distanceMonitor
and run through the distance-monitor pseudobonds with:
for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()...
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Cordiali saluti, Dr.Oteri Francesco

Hai oteri, I tried the way you had suggested but still i get some error. chimera comes with its own python and i dnt know if there is a clash. Could you please write me why this ImportError happens. [cbala@RAMANA ~]$ export PYTHONPATH=/usr/local/chimera_15/lib:/usr/local/chimera_15/share:$PYTHONPATH [cbala@RAMANA ~]$ export LD_LIBRARY=/usr/local/chimera_15/lib:$LD_LIBRARY [cbala@RAMANA ~]$ python Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import chimera Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 15, in <module>
ImportError: libgfxinfo.so: cannot open shared object file: No such file or directory --------------------------------------------------------------------------------------------------------------------- On Tue, May 18, 2010 at 1:39 PM, francesco oteri <francesco.oteri@gmail.com>wrote:
Dear bala, to invoke chimera as a python module ( Question 2) you should execute the following steps:
1) Finding the root directory of the chimera installation (example:/usr/local/chimera ) 2) export LD_LIBRARY=/usr/local/chimera/lib:$LD_LIBRARY 3) export PYTHONPATH=/usr/local/chimera/lib:/usr/local/chimera/share:$PYTHONPATH
The result is:
oteri@priestley:~$ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import chimera
2010/5/18 Bala subramanian <bala.biophysics@gmail.com>
Dear Eric and Elaine,
*Thank you so much for your inputs*. I could implement the 'weighted distance' representation. I have certain queries. I would appreciate your inputs for the same.
1) When i type help(object) in chimera's python shell, it shows the help message, is there any to way to make the help information to be displayed in a separate window. I tried in config setting but i couldnt make it.
2) Is there any way to invoke chimera within normal python interpreter. I am able to do this for pymol. But i dnt know if i can do the same with chimera. I tried to set PYTHONPATH, but it vain.
[cbala@RAMANA ~]$ python Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import pymol
3) In the following code, i am collecting Cbeta atoms from two groups of residues and calculating the cb-cb distance. If instead of Cbeta, i have to calculate the side chain COM-COM (center of mass) distance between two groups of residues, how can i do it or which module should i use.
4)What is the syntax to change the color of pseudobonds ?
*I am pasting the script below so that it may be useful to someone who wants to do a similar thing. *
import chimera from StructMeasure.DistMonitor import *
model=chimera.openModels.open('trial.pdb') res=model[0].residues don_atom=[];acp_atom=[]
#collecting CB atoms of donor and acceptor residues
for x in res: if x.type in ['ARG','GLN']: don_atom.append(x.atomsMap['CB'][0]) elif x.type=='GLU': acp_atom.append(x.atomsMap['CB'][0]) else: continue
#open the distance weight data
weight={} for line in open('rad.dat'): line=line.split() weight[float(line[0])]=line[1]
b=[] #pseudo bond list
for v1 in don_atom: for v2 in acp_atom: b.append(distanceMonitor.newPseudoBond(v1,v2))
#changing pseudo bond features
for pb in b: pb.drawMode=1 chi=round(pb.length()) if chi in weight: pb.radius=float(weight[chi])
Thanks, Bala
On Mon, May 10, 2010 at 8:07 PM, Eric Pettersen <pett@cgl.ucsf.edu>wrote:
Oops. The module name is "StructMeasure", not "StructureMeasure", so the correct line of Python would be:
from StructMeasure.DistMonitor import distanceMonitor
--Eric
On May 10, 2010, at 3:36 AM, Bala subramanian wrote:
Dear Elaine and Eric, Thanks for the inputs. I started the chimera interface and tried to use the StructureMeasure module using the IDLE that is present in chimera but it shows me import Error. I dnt understand why. I am using chimera 1.5 alpha version 29904. Do i need to set some path to use the module.
from StructureMeasure import * Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from StructureMeasure import * ImportError: No module named StructureMeasure
Bala
On Wed, May 5, 2010 at 8:37 PM, Eric Pettersen <pett@cgl.ucsf.edu>wrote:
On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance-monitor pseudobond group in Chimera with:
from StructureMeasure.DistMonitor import distanceMonitor
and run through the distance-monitor pseudobonds with:
for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()...
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Cordiali saluti, Dr.Oteri Francesco

Excuse me but the problem is at point 2: I wrote: export LD_LIBRARY=/usr/local/chimera_15/lib:$LD_LIBRARY buy the right way is: export LD_LIBRARY_PATH=/usr/local/chimera_15/lib:$LD_LIBRARY_PATH Try it!!!! 2010/5/18 Bala subramanian <bala.biophysics@gmail.com>
Hai oteri, I tried the way you had suggested but still i get some error. chimera comes with its own python and i dnt know if there is a clash. Could you please write me why this ImportError happens.
[cbala@RAMANA ~]$ export PYTHONPATH=/usr/local/chimera_15/lib:/usr/local/chimera_15/share:$PYTHONPATH [cbala@RAMANA ~]$ export LD_LIBRARY=/usr/local/chimera_15/lib:$LD_LIBRARY
[cbala@RAMANA ~]$ python Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import chimera
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 15, in <module>
ImportError: libgfxinfo.so: cannot open shared object file: No such file or directory
---------------------------------------------------------------------------------------------------------------------
On Tue, May 18, 2010 at 1:39 PM, francesco oteri < francesco.oteri@gmail.com> wrote:
Dear bala, to invoke chimera as a python module ( Question 2) you should execute the following steps:
1) Finding the root directory of the chimera installation (example:/usr/local/chimera ) 2) export LD_LIBRARY=/usr/local/chimera/lib:$LD_LIBRARY 3) export PYTHONPATH=/usr/local/chimera/lib:/usr/local/chimera/share:$PYTHONPATH
The result is:
oteri@priestley:~$ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import chimera
2010/5/18 Bala subramanian <bala.biophysics@gmail.com>
Dear Eric and Elaine,
*Thank you so much for your inputs*. I could implement the 'weighted distance' representation. I have certain queries. I would appreciate your inputs for the same.
1) When i type help(object) in chimera's python shell, it shows the help message, is there any to way to make the help information to be displayed in a separate window. I tried in config setting but i couldnt make it.
2) Is there any way to invoke chimera within normal python interpreter. I am able to do this for pymol. But i dnt know if i can do the same with chimera. I tried to set PYTHONPATH, but it vain.
[cbala@RAMANA ~]$ python Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import pymol
3) In the following code, i am collecting Cbeta atoms from two groups of residues and calculating the cb-cb distance. If instead of Cbeta, i have to calculate the side chain COM-COM (center of mass) distance between two groups of residues, how can i do it or which module should i use.
4)What is the syntax to change the color of pseudobonds ?
*I am pasting the script below so that it may be useful to someone who wants to do a similar thing. *
import chimera from StructMeasure.DistMonitor import *
model=chimera.openModels.open('trial.pdb') res=model[0].residues don_atom=[];acp_atom=[]
#collecting CB atoms of donor and acceptor residues
for x in res: if x.type in ['ARG','GLN']: don_atom.append(x.atomsMap['CB'][0]) elif x.type=='GLU': acp_atom.append(x.atomsMap['CB'][0]) else: continue
#open the distance weight data
weight={} for line in open('rad.dat'): line=line.split() weight[float(line[0])]=line[1]
b=[] #pseudo bond list
for v1 in don_atom: for v2 in acp_atom: b.append(distanceMonitor.newPseudoBond(v1,v2))
#changing pseudo bond features
for pb in b: pb.drawMode=1 chi=round(pb.length()) if chi in weight: pb.radius=float(weight[chi])
Thanks, Bala
On Mon, May 10, 2010 at 8:07 PM, Eric Pettersen <pett@cgl.ucsf.edu>wrote:
Oops. The module name is "StructMeasure", not "StructureMeasure", so the correct line of Python would be:
from StructMeasure.DistMonitor import distanceMonitor
--Eric
On May 10, 2010, at 3:36 AM, Bala subramanian wrote:
Dear Elaine and Eric, Thanks for the inputs. I started the chimera interface and tried to use the StructureMeasure module using the IDLE that is present in chimera but it shows me import Error. I dnt understand why. I am using chimera 1.5 alpha version 29904. Do i need to set some path to use the module.
> from StructureMeasure import * Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from StructureMeasure import * ImportError: No module named StructureMeasure
Bala
On Wed, May 5, 2010 at 8:37 PM, Eric Pettersen <pett@cgl.ucsf.edu>wrote:
On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance-monitor pseudobond group in Chimera with:
from StructureMeasure.DistMonitor import distanceMonitor
and run through the distance-monitor pseudobonds with:
for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()...
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Cordiali saluti, Dr.Oteri Francesco
-- Cordiali saluti, Dr.Oteri Francesco

Hi Bala, On May 18, 2010, at 2:04 AM, Bala subramanian wrote:
Dear Eric and Elaine,
Thank you so much for your inputs. I could implement the 'weighted distance' representation. I have certain queries. I would appreciate your inputs for the same.
1) When i type help(object) in chimera's python shell, it shows the help message, is there any to way to make the help information to be displayed in a separate window. I tried in config setting but i couldnt make it.
I don't know of any way to make help() output go elsewhere.
2) Is there any way to invoke chimera within normal python interpreter. I am able to do this for pymol. But i dnt know if i can do the same with chimera. I tried to set PYTHONPATH, but it vain.
[cbala@RAMANA ~]$ python Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import pymol
Francesco's reply seemed like the right approach.
3) In the following code, i am collecting Cbeta atoms from two groups of residues and calculating the cb-cb distance. If instead of Cbeta, i have to calculate the side chain COM-COM (center of mass) distance between two groups of residues, how can i do it or which module should i use.
The general approach I would use is to: 3a) gather the residues' atoms 3b) screen out all hydrogens (since it will be tricky to eliminate only main-chain hydrogens due to possible variant naming schemes) 3c) screen out main-chain heavy atoms 3d) compute center of mass If one of the groups of residues was named 'rg1', then something like this: atoms = [a for r in rg1 for a in r] heavys = [a for a in atoms if a.element.number > 1] sides = [a for a in heavys if a.name not in ['C', 'CA', 'N', 'O', 'OXT']] from chimera import Point com = Point([a.xformCoord() for a in sides], [a.element.mass for a in sides]) If you had computed 'com1' and 'com2', then the distance would be: com1.distance(com2)
4)What is the syntax to change the color of pseudobonds ?
You assign a Color object to the pseudobond's 'color' attribute. If you know the colors' red, green, blue, and alpha (opacity) values (each in the range 0-1), you could get a Color object with: from chimera import MaterialColor color = MaterialColor(r, g, b, a) If you know the color name you'd like to use, then: from chimera.colorTable import getColorByName color = getColorByName("spring green")
I am pasting the script below so that it may be useful to someone who wants to do a similar thing.
import chimera from StructMeasure.DistMonitor import *
model=chimera.openModels.open('trial.pdb') res=model[0].residues don_atom=[];acp_atom=[]
#collecting CB atoms of donor and acceptor residues
for x in res: if x.type in ['ARG','GLN']: don_atom.append(x.atomsMap['CB'][0]) elif x.type=='GLU': acp_atom.append(x.atomsMap['CB'][0]) else: continue
#open the distance weight data
weight={} for line in open('rad.dat'): line=line.split() weight[float(line[0])]=line[1]
b=[] #pseudo bond list
for v1 in don_atom: for v2 in acp_atom: b.append(distanceMonitor.newPseudoBond(v1,v2))
#changing pseudo bond features
for pb in b: pb.drawMode=1 chi=round(pb.length()) if chi in weight: pb.radius=float(weight[chi])
Thanks, Bala
On Mon, May 10, 2010 at 8:07 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote: Oops. The module name is "StructMeasure", not "StructureMeasure", so the correct line of Python would be:
from StructMeasure.DistMonitor import distanceMonitor
--Eric
On May 10, 2010, at 3:36 AM, Bala subramanian wrote:
Dear Elaine and Eric, Thanks for the inputs. I started the chimera interface and tried to use the StructureMeasure module using the IDLE that is present in chimera but it shows me import Error. I dnt understand why. I am using chimera 1.5 alpha version 29904. Do i need to set some path to use the module.
from StructureMeasure import * Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from StructureMeasure import * ImportError: No module named StructureMeasure
Bala
On Wed, May 5, 2010 at 8:37 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote: On May 5, 2010, at 10:28 AM, Elaine Meng wrote:
With Chimera commands, you can create a distance monitor and set its stick thickness, color, etc.: open 1zik alias pair1 #0:22.a@oe2:25@ne dist pair1 setattr p drawMode 1 pair1 setattr p radius .05 pair1 setattr p color hot pink pair1 setattr p label " " pair1
However, it sounds like python will be necessary to conditionally set radius or color depending on the value of the distance.
A little more info on this possibility. You can get the distance- monitor pseudobond group in Chimera with:
from StructureMeasure.DistMonitor import distanceMonitor
and run through the distance-monitor pseudobonds with:
for pb in distanceMonitor.pseudoBonds: ...do something that sets pb.radius based on pb.length()...
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
participants (4)
-
Bala subramanian
-
Elaine Meng
-
Eric Pettersen
-
francesco oteri