[Chimera-users] undisplay label in distance monitor

Eric Pettersen pett at cgl.ucsf.edu
Tue Jun 5 11:27:12 PDT 2012

On Jun 4, 2012, at 11:54 PM, Bala subramanian wrote:

> Friends,
> I have written a script to draw lines between atoms (using distance  
> monitor). I dnt want the distance label to be displayed with the  
> pseudo bond. Kindly write me the way to remove the label. My script  
> is below.
> model=chimera.openModels.open('myavg.pdb')
> res=model[0].residues
> MAT=loadtxt('mymatrix',dtype=float)
> chimera.runCommand('focus')
> for x in range(len(res)):
>   for y in range(len(res)):
>       if x <> y :
>           value=MAT[x,y]
>         if  0.5 < value > 0.75:
>            b=distanceMonitor.newPseudoBond(res[x].atomsMap['CA'] 
> [0],res[y].atomsMap['CA'][0])
>            b.drawMode=1
>            b.radius=0.05
>            #b.label=None   I tried keeping this value as None and  
> empty string but it doesnt help.
>            b.color=getColorByName('red')
>         else: pass
>       else: continue

Hi Bala,
	distanceMonitor pseudobonds are designed to do exactly what you find  
them to be doing:  showing an updated distance as the model is moved.   
What you need to do is make a normal pseudobond group for your own use  
that doesn't have all the special processing that distanceMonitor  
provides.  Here is some example code:

from chimera.misc import getPseudoBondGroup
grp = getPseudoBondGroup("matrix bonds", associateWith=[model])

...then later...

b = grp.newPseudoBond(res[x].atomsMap['CA'][0], res[y].atomsMap['CA'] 

You will probably want to set some attributes of your group, like  
color and line type (dashed vs. solid).  Here's some code for that:

import chimera
from chimera.colorTable import getColorByName
grp.color = getColorByName("lime green")
grp.lineType = chimera.Dash


P.S.  BTW, this question is probably better for chimera-dev than  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20120605/a8a42bee/attachment.html>

More information about the Chimera-users mailing list