> The question is: how can I then delete the created MyColor > object? I tried the cmd.delete command, it does not generate > an error but apparently the color is still defined... Any idea?!
Colors can't be undefined, and that would especially be true if an object is still using a given color, since colors in PyMOL are based on lookups. MyColor isn't so much an object as an entry in the global color table. Cheers, Warren -- Warren L. DeLano, Ph.D. Principal Scientist . DeLano Scientific LLC . 400 Oyster Point Blvd., Suite 213 . South San Francisco, CA 94080 USA . Biz:(650)-872-0942 Tech:(650)-872-0834 . Fax:(650)-872-0273 Cell:(650)-346-1154 . mailto:war...@delsci.com > -----Original Message----- > From: pymol-users-ad...@lists.sourceforge.net > [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of > Grégori Gerebtzoff > Sent: Wednesday, August 10, 2005 10:43 AM > To: pymol-users@lists.sourceforge.net > Subject: RE: [PyMOL] Before the release of PyMol 0.99: > Nucleotides and CGO > > Same script, but with hydrogen bonds between nucleotides. > > Load the pdb file 127D, run the script and type 'DrawNT' in > PyMol command line... > > > > > > I have a question, maybe Warren you can answer: > > I wanted to use the set_color command to define a new color > for the Hydrogen bonds (MyRGBColor = [x,y,z] and then > cmd.set_color("MyColor", MyRGBColor)) > > And finally apply the created color to the Hydrogen bonds > (cmd.distance('MyDistance', Selection1, Selection2) and then > cmd.color("MyColor", "MyDistance")) > > The question is: how can I then delete the created MyColor > object? I tried the cmd.delete command, it does not generate > an error but apparently the color is still defined... Any idea?! > > > > > > > > Cheers, > > > Greg > > > > > > > > > > from pymol import cmd > > from pymol.cgo import * > > from Numeric import * > > import sys,re > > > > # COLOR SETTINGS: > > AColor=[0.2,1,0.2] > > TColor=[1,0.2,0.2] > > CColor=[0.3,0.3,1] > > GColor=[1,0.55,0.15] > > HColor="magenta" > > > > def DrawNT(select="all"): > > CurrentView = cmd.get_view(1) > > CurrentResi = 0 > > FirstRun = 1 > > NTPlate = [BEGIN,TRIANGLE_FAN] > > > > # THYMINE > > BaseT = cmd.get_model("resn T") > > for atoms in BaseT.atom: > > if (CurrentResi != atoms.resi): > > CurrentResi = atoms.resi > > if FirstRun == 0: > > NTPlate.append(END) > > NTPlate.extend([BEGIN,TRIANGLE_FAN]) > > NTPlate.extend([COLOR]+TColor) > > else: > > NTPlate.extend([COLOR]+TColor) > > FirstRun = 0 > > if (atoms.name == "N1") or (atoms.name == "C2") or > (atoms.name == "N3") or (atoms.name == "C4") or (atoms.name > == "C5") or (atoms.name == "C6"): > > NTPlate.extend([VERTEX] + atoms.coord) > > if atoms.name == "N3": > > Sel1 = > '%s/%s/%s/%s'%(atoms.segi,atoms.chain,atoms.resi,atoms.name) > > cmd.select('Sel2','%s around 3.1 and name N1 and > not chain %s'%(Sel1,atoms.chain)) > > cmd.distance('Dst', Sel1, "Sel2") > > elif atoms.name == "O4": > > Sel1 = > '%s/%s/%s/%s'%(atoms.segi,atoms.chain,atoms.resi,atoms.name) > > cmd.select('Sel2','%s around 3.1 and name N6 and > not chain %s'%(Sel1,atoms.chain)) > > cmd.distance('Dst', Sel1, "Sel2") > > # ADENINE > > BaseA = cmd.get_model("resn A") > > for atoms in BaseA.atom: > > if (CurrentResi != atoms.resi): > > CurrentResi = atoms.resi > > if FirstRun == 0: > > NTPlate.append(END) > > NTPlate.extend([BEGIN,TRIANGLE_FAN]) > > NTPlate.extend([COLOR]+AColor) > > else: > > NTPlate.extend([COLOR]+AColor) > > FirstRun = 0 > > if (atoms.name == "N1") or (atoms.name == "C2") or > (atoms.name == "N3") or (atoms.name == "C4") or (atoms.name > == "C5") or (atoms.name == "C6"): > > NTPlate.extend([VERTEX] + atoms.coord) > > if (atoms.name == "C4"): > > TmpC4 = atoms.coord > > elif (atoms.name == "C5"): > > TmpC5 = atoms.coord > > elif (atoms.name == "N7"): > > NTPlate.append(END) > > NTPlate.extend([BEGIN,TRIANGLE_FAN]) > > NTPlate.extend([COLOR]+AColor) > > NTPlate.extend([VERTEX] + TmpC4) > > NTPlate.extend([VERTEX] + TmpC5) > > NTPlate.extend([VERTEX] + atoms.coord) > > elif (atoms.name == "C8") or (atoms.name == "N9"): > > NTPlate.extend([VERTEX] + atoms.coord) > > > > # CYTOSINE > > BaseC = cmd.get_model("resn C") > > for atoms in BaseC.atom: > > if (CurrentResi != atoms.resi): > > CurrentResi = atoms.resi > > if FirstRun == 0: > > NTPlate.append(END) > > NTPlate.extend([BEGIN,TRIANGLE_FAN]) > > NTPlate.extend([COLOR]+CColor) > > else: > > NTPlate.extend([COLOR]+CColor) > > FirstRun = 0 > > if (atoms.name == "N1") or (atoms.name == "C2") or > (atoms.name == "N3") or (atoms.name == "C4") or (atoms.name > == "C5") or (atoms.name == "C6"): > > NTPlate.extend([VERTEX] + atoms.coord) > > if atoms.name == "O2": > > Sel1 = > '%s/%s/%s/%s'%(atoms.segi,atoms.chain,atoms.resi,atoms.name) > > cmd.select('Sel2','%s around 3.1 and name N2 and > not chain %s'%(Sel1,atoms.chain)) > > cmd.distance('Dst', Sel1, "Sel2") > > elif atoms.name == "N3": > > Sel1 = > '%s/%s/%s/%s'%(atoms.segi,atoms.chain,atoms.resi,atoms.name) > > cmd.select('Sel2','%s around 3.1 and name N1 and > not chain %s'%(Sel1,atoms.chain)) > > cmd.distance('Dst', Sel1, "Sel2") > > elif atoms.name == "N4": > > Sel1 = > '%s/%s/%s/%s'%(atoms.segi,atoms.chain,atoms.resi,atoms.name) > > cmd.select('Sel2','%s around 3.1 and name O6 and > not chain %s'%(Sel1,atoms.chain)) > > cmd.distance('Dst', Sel1, "Sel2") > > > > # GUANINE > > BaseG = cmd.get_model("resn G") > > for atoms in BaseG.atom: > > if (CurrentResi != atoms.resi): > > CurrentResi = atoms.resi > > if FirstRun == 0: > > NTPlate.append(END) > > NTPlate.extend([BEGIN,TRIANGLE_FAN]) > > NTPlate.extend([COLOR]+GColor) > > else: > > NTPlate.extend([COLOR]+GColor) > > FirstRun = 0 > > if (atoms.name == "N1") or (atoms.name == "C2") or > (atoms.name == "N3") or (atoms.name == "C4") or (atoms.name > == "C5") or (atoms.name == "C6"): > > NTPlate.extend([VERTEX] + atoms.coord) > > if (atoms.name == "C4"): > > TmpC4 = atoms.coord > > elif (atoms.name == "C5"): > > TmpC5 = atoms.coord > > elif (atoms.name == "N7"): > > NTPlate.append(END) > > NTPlate.extend([BEGIN,TRIANGLE_FAN]) > > NTPlate.extend([COLOR]+GColor) > > NTPlate.extend([VERTEX] + TmpC4) > > NTPlate.extend([VERTEX] + TmpC5) > > NTPlate.extend([VERTEX] + atoms.coord) > > elif (atoms.name == "C8") or (atoms.name == "N9"): > > NTPlate.extend([VERTEX] + atoms.coord) > > NTPlate.append(END) > > cmd.load_cgo(NTPlate,"PLAIN_NT") > > cmd.select("chain1", "name C3*+C4*+C5*+O5*+P+O3*") > > cmd.show("cartoon", "chain1") > > cmd.cartoon("dumbbell", "chain1") > > cmd.set("cartoon_nucleic_acid_mode", 1, "chain1") > > cmd.delete("chain1") > > cmd.hide("label", "Dst") > > cmd.color(HColor, "Dst") > > cmd.delete("Sel2") > > cmd.set_view(CurrentView) > > cmd.extend("DrawNT",DrawNT) > >