# Make schematic display of selected DNA/RNA residues.

# make selected atoms and bonds invisible
StyleAtom invisible
StyleBond invisible

# store current selection
DefPropAtom 'prev_sel' 'selected'
DefPropBond 'prev_sel' 'selected'
DefPropPrim 'prev_sel' 'selected'

# set property for residues that ribbon will be added to
DefPropRes 'new_ribbon' 'mol.selected & selected'

# deselect all primitives so that we can set the color only
# on the new ribbons and set the selection to the previously
# selected primitives + new ribbons at the end
SelectPrim '0'

# set the helix property on the resdiues that the ribbon is
# added to, we always want the DNA to be displayed as helix
DefPropRes 'helix' 'helix | new_ribbon'

# add ribbon through C3*/C3' atoms
SelectAtom 'res.new_ribbon & name = "C3*"'
AddRibbon

# set property on new ribbons (new items are always selected,
# and we deselected other primitives before, so the new
# ribbons are the only primitives selected)
DefPropPrim 'new_ribbon' 'selected'

# set ribbon attributes that normally look good for DNA
TypeRibbon interpol spacing
StyleRibbon ellip sharp sharp
SizeRibbon 3.0 1.0

# set color to dark grey (outside) and light grey (inside)
ColorPrim 0.1 0.1 0.1
TintPrim 0.9 0.9 0.9

# add pink plates for sugar rings
SelectPrim '0'
SelectAtom 'res.new_ribbon & sugar'
AddPlates
DefPropPrim 'new_ribbon' 'new_ribbon | selected'
ColorPrim 1 0.0 0.5

# add orange red rings for A bases
SelectPrim '0'
SelectAtom 'res.new_ribbon & (res.name = "ADE*" | res.name = "A") & base'
AddPlates
DefPropPrim 'new_ribbon' 'new_ribbon | selected'
ColorPrim 1 0.2 0

# make A bonds orange red
SelectBond 'res.new_ribbon & (res.name = "ADE*" | res.name = "A")'
ColorBond 1 0.2 0

# add yellow rings for T bases
SelectPrim '0'
SelectAtom 'res.new_ribbon & (res.name = "THY*" | res.name = "T") & base'
AddPlates
DefPropPrim 'new_ribbon' 'new_ribbon | selected'
ColorPrim 1 1 0

# make T bonds yellow
SelectBond 'res.new_ribbon & (res.name = "THY*" | res.name = "T")'
ColorBond 1 1 0

# add green rings for G bases
SelectPrim '0'
SelectAtom 'res.new_ribbon & (res.name = "GUA*" | res.name = "G") & base'
AddPlates
DefPropPrim 'new_ribbon' 'new_ribbon | selected'
ColorPrim 0 0 1

# make G bonds green
SelectBond 'res.new_ribbon & (res.name = "GUA*" | res.name = "G")'
ColorBond 0 0 1

# add cyan rings for C bases
SelectPrim '0'
SelectAtom 'res.new_ribbon & (res.name = "CYT*" | res.name = "C") & base'
AddPlates
DefPropPrim 'new_ribbon' 'new_ribbon | selected'
ColorPrim 0 1 1

# make C bonds cyan
SelectBond 'res.new_ribbon & (res.name = "CYT*" | res.name = "C")'
ColorBond 0 1 1

# add magenta rings for U bases
SelectPrim '0'
SelectAtom 'res.new_ribbon & (res.name = "URA*" | res.name = "U") & base'
AddPlates
DefPropPrim 'new_ribbon' 'new_ribbon | selected'
ColorPrim 1 0 1

# make U bonds magenta
SelectBond 'res.new_ribbon & (res.name = "URA*" | res.name = "U")'
ColorBond 1 0 1

# display bond connecting backbone and rings
SelectBond 'res.new_ribbon & atom1.name = "C1*" && atom2.name = "N?"'
StyleBond neon

# restore previous selection, with newly created
# ribbons/plates added
SelectAtom 'prev_sel'
SelectBond 'prev_sel'
SelectPrim 'prev_sel | new_ribbon'