Beispiel #1
0
def pretty_protein(sele="(all)"):
    """DESCRIPTION

    This is my default display. It displays the protein as cartoon, but
    highlights ligands and ions as sticks or spheres.

USAGE

    pretty_protein [selection]

AUTHOR

    Spencer Bliven
"""
    cmd.hide("lines",sele)
    cmd.hide("everything","( %s ) and solvent"%sele)
    cmd.show("cartoon",sele)
    # disulfides
    cmd.show("sticks","( %s ) and (cys/ca+cb+sg) and byres (cys/sg and bound_to cys/sg)"%sele)
    # ligands
    cmd.show("sticks","( %s ) and hetatm and not solvent and not hydrogen and not resn MSE"%sele)
    # metals
    cmd.show("spheres","( %s ) and not elem c+n+o+h+s and not resn MSE"%sele)
    # color carbon by chain & others by element
    util.cbc(sele)
    util.cnc(sele)
Beispiel #2
0
def surface_view(surface=None):
    '''
    Show the surface of the molecule in different representations
    '''
    glb.update()
    util.cbc()
    cmd.hide('all')
    if surface == 'dot':
        cmd.set('dot_density', 1)
        cmd.show('lines', 'all')
        cmd.show('dots', 'all')
    elif surface == 'mesh':
        cmd.set('mesh_quality', 3)
        cmd.show('stick', 'all')
        cmd.show('mesh', 'all')
    elif surface == 'sphere':
        cmd.set('sphere_scale', 0.5, 'all')
        cmd.show('spheres', 'all')
        cmd.show('surface', 'all')
        cmd.set('transparency', 0.5, 'all')
    elif surface == 'stick':
        cmd.show('stick', 'all')
        cmd.show('surface', 'all')
        cmd.set('transparency', 0.5, 'all')
    elif surface == 'toon':
        cmd.set('cartoon_smooth_loops', 0)
        cmd.show('cartoon', 'all')
        cmd.show('surface', 'all')
        cmd.set('transparency', 0.5, 'all')
    else:
        cmd.show('surface', 'all')
Beispiel #3
0
def surface_view(surface = None):
    '''
    Show the surface of the molecule in different representations
    '''
    glb.update()
    util.cbc()
    cmd.hide('all')
    if surface == 'dot':
        cmd.set('dot_density',1)
        cmd.show('lines','all')
        cmd.show('dots','all')
    elif surface == 'mesh':
        cmd.set('mesh_quality',3)
        cmd.show('stick','all')
        cmd.show('mesh','all')
    elif surface == 'sphere':
        cmd.set('sphere_scale',0.5,'all')
        cmd.show('spheres','all')
        cmd.show('surface','all')
        cmd.set('transparency',0.5,'all')
    elif surface == 'stick':
        cmd.show('stick','all')
        cmd.show('surface','all')
        cmd.set('transparency',0.5,'all')
    elif surface == 'toon':
        cmd.set('cartoon_smooth_loops', 0)
        cmd.show('cartoon','all')
        cmd.show('surface','all')
        cmd.set('transparency',0.5,'all')
    else:
        cmd.show('surface','all')
Beispiel #4
0
def prepare_pymol():
    cmd.clip("near", 100000)
    cmd.clip("slab", 100000)
    cmd.clip("far", -100000)
    cmd.show("spheres")
    cmd.unpick()
    util.cbc()
Beispiel #5
0
def pre_cartoon_view(tag):
    if tag == 'Cartoon':
        cartoon_view()
    elif tag == 'Putty':
        cartoon_view('putty')
    elif tag == 'Lines on Cartoon':
        stick_toon()
    elif tag == 'Color by Chain':
        util.cbc()
Beispiel #6
0
def pre_cartoon_view(tag):
    if tag == 'Cartoon':
        cartoon_view()
    elif tag == 'Putty':
        cartoon_view('putty')
    elif tag == 'Lines on Cartoon':
        stick_toon()
    elif tag == 'Color by Chain':
        util.cbc()
def find_and_show_interface() :
    cmd.show( 'cartoon' )
    cmd.hide( 'lines', 'elem H' )

    cmd.set('cartoon_transparency','0.5')
    util.cbc("elem C")

    loaded_objs = cmd.get_names('objects')
    create_interface_selections()
    for obj in loaded_objs :
        cmd.show( "sticks", obj+"intres" )

    cmd.hide( 'sticks', 'elem H' )
Beispiel #8
0
def contrastinterface( pdb4char ) :
    cmd.show( 'cartoon' )
    cmd.hide( 'lines' )
    util.cbc( 'elem C' )
    cmd.set('cartoon_transparency','0.5')
    
    v3_lines = open( "/home/andrew/rosetta/interface_seqrec_benchmark/pdbs/v3/interface_definitions/" + pdb4char + "_dsintdef.txt" ).readlines()
#    benlines = open( "/home/andrew/rosetta/interface_seqrec_benchmark/pdbs/ben8Acut/interface_definitions/" + pdb4char + "_dsintdef.txt" ).readlines()
#    benlines = open( "/home/andrew/rosetta/interface_seqrec_benchmark/pdbs/benV3dup_A/interface_definitions/" + pdb4char + "_dsintdef.txt" ).readlines()
#    benlines = open( "/home/andrew/rosetta/interface_seqrec_benchmark/pdbs/benV3dup_B/interface_definitions/" + pdb4char + "_dsintdef.txt" ).readlines()
    benlines = open( "/home/andrew/rosetta/interface_seqrec_benchmark/pdbs/benV3dup_C/interface_definitions/" + pdb4char + "_dsintdef.txt" ).readlines()

    v3 = set({})
    ben = set({})
    for line in v3_lines :
        v3.add( line.strip() )
    for line in benlines:
        ben.add( line.strip() )

    v3_not_ben = v3 - ben
    ben_not_v3 = ben - v3

    print "v3 size:", len( v3)
    print "ben size: ", len( ben)
    print "v3 not ben: ", len( v3_not_ben )
    print "ben not v3: ", len( ben_not_v3 )


    v3mben_sel = sel_from_reschain_set( v3_not_ben )
    benmv3_sel = sel_from_reschain_set( ben_not_v3 )
    common_sel = sel_from_reschain_set( v3.intersection( ben ) )

    print "v3mben_sel: ", v3mben_sel
    print "benmv3_sel: ", benmv3_sel

    if len(v3_not_ben):
        cmd.select( "v3", v3mben_sel )
        cmd.create( "v3obj", "v3" )
        cmd.show( "sticks", "v3obj" )
        cmd.color( "red", "v3obj" )
    if len(ben_not_v3):
        cmd.select( "ben", benmv3_sel )
        cmd.create( "benobj", "ben" )
        cmd.show( "sticks", "benobj" )
        cmd.color( "pink", "benobj" )
    if len(common_sel):
        cmd.select( "common", common_sel )
        cmd.create( "commonobj", "common" )
        cmd.show( "sticks", "commonobj" )

    cmd.hide( "sticks", "elem H" )
Beispiel #9
0
def prepare_pymol():
    cmd.set("ray_trace_color", "black")
    cmd.set("ray_trace_gain", 0)
    cmd.set("ray_trace_mode", 3)
    cmd.set("depth_cue", 0)
    cmd.clip("near", 100000)
    cmd.clip("slab", 100000)
    cmd.clip("far", -100000)
    cmd.hide("all")
    util.cbc()
    cmd.show('surface')
    cmd.bg_color("black")
    cmd.zoom("all", buffer=2.0) # buffer might help clipping problem
    cmd.center("all")
    cmd.deselect()
Beispiel #10
0
def zn_interface():

    cmd.show( 'cartoon' )
    cmd.hide( 'lines', 'elem H' )
    util.cbc("elem C")
    cmd.show( 'sticks', 'resn znx')

    cmd.set('cartoon_transparency','0.5')
    cmd.hide( 'sticks', 'elem H' )

    loaded_objs = cmd.get_names('objects')
    print loaded_objs

    for obj in loaded_objs :
        cmd.dist( '"'+obj+'_polar_conts"','"'+obj+'"','"'+obj+'"',quiet=1,mode=2,label=0,reset=1)
        cmd.enable("'"+obj+'_polar_conts"')
Beispiel #11
0
def showinterface( intdef_file ):

    cmd.show( 'cartoon' )
    #get rid of old stuffs
    cmd.hide( 'lines' )
    cmd.hide( 'sticks' )
    
    lines = open( intdef_file ).readlines()
    for line in lines :
	selset = 'res ' + line.split(" " )[1][:-1] + ' and chain ' + line.split(" " )[ 0 ]
	#print selset
        cmd.show( 'sticks', selset )

    cmd.set('cartoon_transparency','0.4')
    util.cbc("elem C") #colors by chain
    cmd.hide( 'sticks', 'elem H' )
    cmd.hide( 'lines', 'elem H' )
Beispiel #12
0
    def reinitPymol(self, pdb):
        if len(self.pdb) == 4 and self.pdb == re.match('[a-zA-Z0-9]*',
                                                       self.pdb).group(0):
            cmd.delete(self.pdb)
        if len(pdb) == 4 and pdb == re.match('[a-zA-Z0-9]*', pdb).group(0):
            self.pdb = pdb
            cmd.fetch(self.pdb, async=0)

        if self.editMolecule:
            cmd.hide('everything', 'all')
            cmd.show('cartoon', 'all')

        # color each chain differently
        if self.editMolecule:
            util.cbc()

        # set origin at camera
        if self.naturalRotation:
            self.setOriginAtCamera()

        # move slab away to give a comfortable viewing area
        cmd.clip('move', 10)
Beispiel #13
0
    def initPymol(self):

        # set stereo mode
        cmd.set('stereo_mode', 3)
        cmd.stereo()

        # get rid of gui
        cmd.set('internal_gui', 0)

        # set resolution to HD for rift
        cmd.viewport(1920, 1080)

        # full screen?
        if self.fullscreen:
            cmd.full_screen('on')

        # load pdb
        if len(self.pdb) == 4 and self.pdb == re.match('[a-zA-Z0-9]*',
                                                       self.pdb).group(0):
            cmd.fetch(self.pdb, async=0)

        if self.editMolecule == True:
            cmd.hide('everything', 'all')
            cmd.show('cartoon', 'all')

        # color each chain differently
        if self.editMolecule:
            util.cbc()

        # set origin at camera
        if self.naturalRotation:
            self.setOriginAtCamera()

        # move slab away to give a comfortable viewing area
        cmd.clip('move', 10)

        # jiggle the camera to deal with blank screen error
        cmd.move('z', .0001)
Beispiel #14
0
            ]
    
    def do_select(self,name):
        pymol.stored.link = ''
        cmd.iterate(name,"stored.link=custom") 
        if len(pymol.stored.link):
            webbrowser.open(pymol.stored.link)
        cmd.delete(name)

# load an example structure

cmd.load("$TUT/1hpv.pdb")

# color by chain (aesthetics)

util.cbc()

# store the links as atom text_types

cmd.alter("name ca",r"custom='http://delsci.info/cgi-bin/click.cgi?residue=%s%s%s'%(resn,resi,chain)")

# put the mouse into single-atom selection mode

cmd.set('mouse_selection_mode',0)

# just show ribbon (means we can only select labelled C-alphas)

cmd.show_as("cartoon") 

# set up the labels
Beispiel #15
0
    def do_select(self, name):
        pymol.stored.link = ''
        cmd.iterate(name, "stored.link=custom")
        if len(pymol.stored.link):
            webbrowser.open(pymol.stored.link)
        cmd.delete(name)


# load an example structure

cmd.load("$TUT/1hpv.pdb")

# color by chain (aesthetics)

util.cbc()

# store the links as atom text_types

cmd.alter(
    "name CA",
    r"custom='http://delsci.info/cgi-bin/click.cgi?residue=%s%s%s'%(resn,resi,chain)"
)

# put the mouse into single-atom selection mode

cmd.set('mouse_selection_mode', 0)

# just show ribbon (means we can only select labelled C-alphas)

cmd.show_as("cartoon")