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 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 getPseudoBondGroupgrp = 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 chimerafrom chimera.colorTable import getColorByNamegrp.color = getColorByName("lime green")grp.lineType = chimera.Dash--EricP.S. BTW, this question is probably better for chimera-dev than chimera-users...