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