Hello List,

 

Maybe useful, maybe not… 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’t find out how to run
perl scripts on my Windows-running PC, and this is exactly (and only) what I
needed.

 

Just run the script, and type ‘DrawNT’ in the PyMol command line.

 

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]

 

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)

 

# 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)

 

# 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.delete("chain1")

    cmd.set_view(CurrentView)

cmd.extend("DrawNT",DrawNT)

Reply via email to