Re: [Chimera-users] undisplay label in distance monitor

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
Thanks, Bala -- C. Balasubramanian

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'] [0]) 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 --Eric P.S. BTW, this question is probably better for chimera-dev than chimera-users...

Dear Eric, I tried the following code but no luck. I dnt see get any error but i dnt see the connection lines between the atoms. import chimera from numpy import loadtxt,matrix,arange from chimera.colorTable import getColorByName from chimera.misc import getPseudoBondGroup model=chimera.openModels.open('mypdb.pdb') res=model[0].residues grp = getPseudoBondGroup("mybonds", associateWith=[model]) MAT=loadtxt('mymatrix',dtype=float) for x in range(len(res)): for y in range(len(res)): if x <> y : value=MAT[x,y] if value > 0.75: b=grp.newPseudoBond(res[x].atomsMap['CA'][0], res[y].atomsMap['CA'][0]) b.lineType = chimera.Dash b.drawmode=1 b.color = getColorByName("lime green") else: pass else: continue Is there something i am missing, Bala On Tue, Jun 5, 2012 at 8:27 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
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'][0])
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
--Eric
P.S. BTW, this question is probably better for chimera-dev than chimera-users...
-- C. Balasubramanian

On Jun 7, 2012, at 8:15 AM, Bala subramanian wrote:
model=chimera.openModels.open('mypdb.pdb') res=model[0].residues grp = getPseudoBondGroup("mybonds", associateWith=[model])
Hi Bala, The above lines need to be different. They either need to be model=chimera.openModels.open('mypdb.pdb') res=model[0].residues grp = getPseudoBondGroup("mybonds", associateWith=model) or model=chimera.openModels.open('mypdb.pdb')[0] res=model.residues grp = getPseudoBondGroup("mybonds", associateWith=[model]) I recommend the latter, since in that one 'model' is a single model, not a list of models. --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
participants (2)
-
Bala subramanian
-
Eric Pettersen