From: <gre...@un...> - 2005-08-08 10:38:35
|
Hello List, =20 Maybe useful, maybe not=85 Here is a small py script for filling = nucleotides with colored CGO objects. I just tried it on the pdb file 127D. Of course not as efficient as Nuccyl!!! But I couldn=92t find out how to = run perl scripts on my Windows-running PC, and this is exactly (and only) = what I needed. =20 Just run the script, and type =91DrawNT=92 in the PyMol command line. =20 Cheers, Greg =20 =20 =20 =20 =20 from pymol import cmd from pymol.cgo import * from Numeric import * import sys,re =20 # COLOR SETTINGS: AColor=3D[0.2,1,0.2] TColor=3D[1,0.2,0.2] CColor=3D[0.3,0.3,1] GColor=3D[1,0.55,0.15] =20 def DrawNT(select=3D"all"): CurrentView =3D cmd.get_view(1) CurrentResi =3D 0 FirstRun =3D 1 NTPlate =3D [BEGIN,TRIANGLE_FAN] =20 # THYMINE BaseT =3D cmd.get_model("resn T") for atoms in BaseT.atom: if (CurrentResi !=3D atoms.resi): CurrentResi =3D atoms.resi if FirstRun =3D=3D 0: NTPlate.append(END) NTPlate.extend([BEGIN,TRIANGLE_FAN]) NTPlate.extend([COLOR]+TColor) else: NTPlate.extend([COLOR]+TColor) FirstRun =3D 0 if (atoms.name =3D=3D "N1") or (atoms.name =3D=3D "C2") or = (atoms.name =3D=3D "N3") or (atoms.name =3D=3D "C4") or (atoms.name =3D=3D "C5") or = (atoms.name =3D=3D "C6"): =20 NTPlate.extend([VERTEX] + atoms.coord) =20 # ADENINE BaseA =3D cmd.get_model("resn A") for atoms in BaseA.atom: if (CurrentResi !=3D atoms.resi): CurrentResi =3D atoms.resi if FirstRun =3D=3D 0: NTPlate.append(END) NTPlate.extend([BEGIN,TRIANGLE_FAN]) NTPlate.extend([COLOR]+AColor) else: NTPlate.extend([COLOR]+AColor) FirstRun =3D 0 if (atoms.name =3D=3D "N1") or (atoms.name =3D=3D "C2") or = (atoms.name =3D=3D "N3") or (atoms.name =3D=3D "C4") or (atoms.name =3D=3D "C5") or = (atoms.name =3D=3D "C6"): =20 NTPlate.extend([VERTEX] + atoms.coord) if (atoms.name =3D=3D "C4"): TmpC4 =3D atoms.coord elif (atoms.name =3D=3D "C5"): TmpC5 =3D atoms.coord elif (atoms.name =3D=3D "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 =3D=3D "C8") or (atoms.name =3D=3D "N9"): NTPlate.extend([VERTEX] + atoms.coord) =20 # CYTOSINE BaseC =3D cmd.get_model("resn C") for atoms in BaseC.atom: if (CurrentResi !=3D atoms.resi): CurrentResi =3D atoms.resi if FirstRun =3D=3D 0: NTPlate.append(END) NTPlate.extend([BEGIN,TRIANGLE_FAN]) NTPlate.extend([COLOR]+CColor) else: NTPlate.extend([COLOR]+CColor) FirstRun =3D 0 if (atoms.name =3D=3D "N1") or (atoms.name =3D=3D "C2") or = (atoms.name =3D=3D "N3") or (atoms.name =3D=3D "C4") or (atoms.name =3D=3D "C5") or = (atoms.name =3D=3D "C6"): =20 NTPlate.extend([VERTEX] + atoms.coord) =20 # GUANINE BaseG =3D cmd.get_model("resn G") for atoms in BaseG.atom: if (CurrentResi !=3D atoms.resi): CurrentResi =3D atoms.resi if FirstRun =3D=3D 0: NTPlate.append(END) NTPlate.extend([BEGIN,TRIANGLE_FAN]) NTPlate.extend([COLOR]+GColor) else: NTPlate.extend([COLOR]+GColor) FirstRun =3D 0 if (atoms.name =3D=3D "N1") or (atoms.name =3D=3D "C2") or = (atoms.name =3D=3D "N3") or (atoms.name =3D=3D "C4") or (atoms.name =3D=3D "C5") or = (atoms.name =3D=3D "C6"): NTPlate.extend([VERTEX] + atoms.coord) if (atoms.name =3D=3D "C4"): TmpC4 =3D atoms.coord elif (atoms.name =3D=3D "C5"): TmpC5 =3D atoms.coord elif (atoms.name =3D=3D "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 =3D=3D "C8") or (atoms.name =3D=3D "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.delete("chain1") cmd.set_view(CurrentView) cmd.extend("DrawNT",DrawNT) |