当前位置: 首页>>代码示例>>Python>>正文


Python cmd.color函数代码示例

本文整理汇总了Python中pymol.cmd.color函数的典型用法代码示例。如果您正苦于以下问题:Python color函数的具体用法?Python color怎么用?Python color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了color函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load

	def load(self):
		self.manager.d = self
		self.manager.m = None
		self.manager.m = None # to also set prevm = None		
		# cmd.delete(self.manager.prevd.obj)
		# cmd.delete(self.manager.prevd.pid)
		# print self.manager.d.obj
		# print self.manager.prevd.obj		
		# sys.exit()
		cmd.delete("all")
		cmd.load(self.getloadname(),self.obj,1)
		cmd.remove(self.obj+" and not chain A")
		cmd.fetch(self.pid)
		cmd.remove("het or hydro")
		cmd.color('gray',self.pid+' and elem C')
		self.scores['rms'] = cmd.align(self.pid,self.obj+" and chain A")[0]
		cmd.hide('ev')
		cmd.show('lines')
		cmd.show("car")
		#cmd.disable(self.pid)
		redopent(self.obj)
		self.recalc_design_pos()
		self.read_data_dir('avg_deg')
		self.read_data_dir('ddG')
		self.read_data_dir('rot_boltz')
		self.read_bup()
		self.read_tot_scores()
		self.read_res_scores()
		cmd.orient(self.obj+" or pnt*")
		self.manager.m = self.remembermm
		if self.manager.m: self.manager.m.focus()
		if self.remembermv: cmd.set_view(self.remembermv)
开发者ID:willsheffler,项目名称:lib,代码行数:32,代码来源:mutalyze_plugin.py

示例2: testAA

    def testAA(self):
        '''
        Make a black/white image and check if gray pixels are found with
        antialias_shader=1/2
        '''
        cmd.viewport(100, 100)

        cmd.set('use_shaders', True)

        self.ambientOnly()

        cmd.fragment('gly')
        cmd.show_as('spheres')
        cmd.color('white')
        cmd.zoom()

        # b/w image, we expect only two color values
        img = self.get_imagearray()
        self.assertTrue(len(numpy.unique(img[...,:3])) == 2)

        for aa in (1, 2):
            cmd.set('antialias_shader', aa)

            # smoothed edges, we expect more than two color values
            img = self.get_imagearray()
            self.assertTrue(len(numpy.unique(img[...,:3])) > 2)
开发者ID:schrodinger,项目名称:pymol-testing,代码行数:26,代码来源:settings.py

示例3: testTrilines

    def testTrilines(self, trilines):
        cmd.viewport(100, 100)

        cmd.set('use_shaders', True)

        self.ambientOnly()

        cmd.set('dynamic_width', 0)
        cmd.set('line_width', 5)
        cmd.set('line_smooth', 0)

        cmd.fragment('ethylene')
        cmd.show_as('lines')
        cmd.color('white')
        cmd.orient()

        cmd.set('trilines', trilines)

        # check percentage of covered pixels
        img = self.get_imagearray()
        npixels = img.shape[0] * img.shape[1]
        covered = numpy.count_nonzero(img[...,:3])
        ratio = covered / float(npixels)
        msg = "covered=%d npixels=%d ratio=%f" % (covered, npixels, ratio)
        self.assertTrue(0.14 < ratio < 0.165, msg)
开发者ID:schrodinger,项目名称:pymol-testing,代码行数:25,代码来源:settings.py

示例4: loadBR

def loadBR(pdb, saveName=None, color=None):
    if not saveName:
        saveName = pdb.split('.')[0]
   
    cmd.load(pdb, saveName)

    if color: cmd.color(color, saveName)
    cmd.hide("lines")
    cmd.hide("nonbonded")
#     cmd.show("cartoon")
    cmd.show("ribbon")

    cmd.set("cartoon_transparency", 0.7)
    keyResidues = ["ASPA0085", "ARGA0082", "GLUA0194", "GLUA0204", "LYSA0216", "RET", "ASPA0212"]
    for eachRes in keyResidues:
        # retinal's residue sequence id can vary in different pdbs.
        selection = ""
        if eachRes == "RET":
            selection = "resn ret"
        else:
            selection = parseResidue(eachRes)
        
        selection += " and not name c+o+n"
        cmd.show("sticks", selection)
        util.cbag(selection)
开发者ID:zxiaoyao,项目名称:br_pscript,代码行数:25,代码来源:loadBR.py

示例5: colorize

def colorize():
    cmd.hide('(not (name C+CA+N+O))')

    cmd.spectrum('b', 'red_yellow_green', minimum='-1.0', maximum='1.0')
    cmd.select('missing', 'b = -2.0')
    cmd.color('white', 'missing')
    cmd.delete('missing')
开发者ID:CunliangGeng,项目名称:Pymol-script-repo,代码行数:7,代码来源:dehydron.py

示例6: chain_contact

def chain_contact():
    def chain_contact_loop(c,skip,chainPullList):
        d = 0
        l = c + 1
        while len(chainPullList) > l and (26-d) >= 0:
            cmd.select('chain_contact','%s w. 5 of %s'%(chainPullList[d],chainPullList[c+1]),enable=0,quiet=1,merge=1)
            cmd.select('chain_contact','%s w. 5 of %s'%(chainPullList[c+1],chainPullList[d]),enable=0,quiet=1,merge=1)
            d += 1
            l += 1
            while d == (c+1) or d in skip:
                d += 1
    glb.update()
    cmd.hide('everything')
    cmd.show('mesh', 'all')
    cmd.color('gray40', 'all')
    objects = cmd.get_names('all')
    chainPullList = []
    for i in cmd.get_chains(quiet=1):
        chainPullList.append('Chain-'+i)
    if len(chainPullList) < 2:
        showinfo('Notice','There needs to be two or more chains to run this functions.')
        return False
    c = 0
    skip = []
    while c < (len(chainPullList)-1) and c < 26:
        skip.append(c+1)
        chain_contact_loop(c,skip,chainPullList)
        c += 1
    glb.procolor('chain_contact','mesh','cpk',None)
    cmd.delete('chain_contact')
    return chainPullList
开发者ID:ssmadha,项目名称:Standalone-ProMol,代码行数:31,代码来源:visual.py

示例7: testLabelPositionZ

    def testLabelPositionZ(self, use_shaders, ray):
        '''
        Test label z position for regular labels
        '''
        if not ray and invocation.options.no_gui:
            self.skipTest('no gui')

        cmd.set('use_shaders', use_shaders)

        cmd.viewport(200, 200)

        cmd.pseudoatom('m1', vdw=10, label='X')
        cmd.zoom(buffer=12)

        cmd.show('spheres')
        cmd.color('blue')
        cmd.set('label_color', 'red')
        cmd.set('label_size', 20)
        cmd.set('label_font_id', 7) # bold
        self.ambientOnly()

        # label outside of sphere
        cmd.set('label_position', [0, 0, 11.1])
        img = self.get_imagearray(ray=ray)
        self.assertImageHasColor('blue', img)
        self.assertImageHasColor('red', img, delta=20)

        # label inside of sphere
        cmd.set('label_position', [0, 0, 10.5])
        img = self.get_imagearray(ray=ray)
        self.assertImageHasColor('blue', img)
        self.assertImageHasNotColor('red', img, delta=20)
开发者ID:schrodinger,项目名称:pymol-testing,代码行数:32,代码来源:labels.py

示例8: fatslim_apl_prot

def fatslim_apl_prot():
    global REF_BEAD
    setup()

    FILENAME = BILAYER_PROT
    REF_BEAD = BILAYER_PROT_REF

    # Load file
    cmd.load("%s.pdb" % FILENAME)
    main_obj = "%s" % FILENAME
    cmd.disable(main_obj)
    traj = load_trajectory("%s.gro" % FILENAME, "%s.ndx" % FILENAME)
    traj.initialize()
    frame = traj[0]
    draw_pbc_box(main_obj)

    cmd.create("protein", "resi 1-160")
    cmd.hide("lines", "protein")
    cmd.color("yellow", "protein")
    cmd.show("cartoon", "protein")
    cmd.show("surface", "protein")
    cmd.set("transparency", 0.5, "protein")
    cmd.set("surface_color", "yelloworange", "protein")

    # Show leaflets
    show_leaflets(frame)

    # Show stuff related to APL
    show_apl(frame)

    print("Bilayer with protein loaded!")
开发者ID:FATSLiM,项目名称:fatslim,代码行数:31,代码来源:fatslim_pymol.py

示例9: updateColor

    def updateColor(self):
        if self.ss_asgn_prog is None:
            err_msg = 'Run DSSP or Stride to assign secondary structures first!'
            print('ERROR: %s' % (err_msg,))
            tkMessageBox.showinfo(title='ERROR', message=err_msg)
        else:
            print('Update color for %s' % (self.pymol_sel.get()), end=' ')
            print('using secondary structure assignment by %s' % (self.ss_asgn_prog,))

            if self.ss_asgn_prog == 'DSSP':
                SSE_list = self.DSSP_SSE_list
            elif self.ss_asgn_prog == 'Stride':
                SSE_list = self.STRIDE_SSE_list

            for sse in SSE_list:  # give color names
                cmd.set_color('%s_color' % (sse,), self.SSE_col_RGB[sse])
            for sse in SSE_list:  # color each SSE
                for sel_obj in self.sel_obj_list:
                    if self.SSE_sel_dict[sel_obj][sse] is not None:
                        cmd.color('%s_color' % (sse,), self.SSE_sel_dict[sel_obj][sse])
                        print('color', self.SSE_sel_dict[sel_obj][sse], ',', self.SSE_col_RGB[sse])
                    else:
                        print('No residues with SSE \'%s\' to color.' % (sse,))

        return
开发者ID:Pymol-Scripts,项目名称:Pymol-script-repo,代码行数:25,代码来源:dssp_stride.py

示例10: rcomp

def rcomp():
    """RNA like in papers ;-)

    Similar to rc() but this time it colors each (and every) structure in different colour.
    Great on viewing-comparing superimposed structures.

    """
    cmd.hide("sticks", "all")
    cmd.hide("lines", "all")
    cmd.show("cartoon", "all")
    cmd.set("cartoon_ring_mode", 3)
    cmd.set("cartoon_ring_finder", 2)
    cmd.set("cartoon_ladder_mode", 2)
    cmd.set("cartoon_ring_transparency", 0.30)

    obj_list = cmd.get_names('objects')

    colours = ['red', 'green', 'blue', 'yellow', 'violet', 'cyan',    \
           'salmon', 'lime', 'pink', 'slate', 'magenta', 'orange', 'marine', \
           'olive', 'purple', 'teal', 'forest', 'firebrick', 'chocolate',    \
           'wheat', 'white', 'grey' ]
    ncolours = len(colours)

           # Loop over objects
    i = 0
    for obj in obj_list:
        print("  ", obj, colours[i])
        cmd.color(colours[i], obj)
        i = i+1
        if(i == ncolours):
           i = 0
开发者ID:mmagnus,项目名称:rna-pdb-tools,代码行数:31,代码来源:PyMOL4RNA.py

示例11: ino

def ino():
    """Sphare and yellow inorganic, such us Mg.

    .. image:: ../../rna_tools/utils/PyMOL4RNA/doc/ion.png"""
    cmd.show("spheres", "inorganic")
    cmd.set('sphere_scale', '0.25', '(all)')
    cmd.color("yellow", "inorganic")
开发者ID:mmagnus,项目名称:rna-pdb-tools,代码行数:7,代码来源:PyMOL4RNA.py

示例12: test

    def test(self):
        cmd.viewport(100, 100)

        # make map
        cmd.fragment('gly', 'm1')
        cmd.set('gaussian_b_floor', 30)
        cmd.set('mesh_width', 5)
        cmd.map_new('map')
        cmd.delete('m1')

        # make mesh 
        cmd.isomesh('mesh', 'map')

        # check mesh presence by color
        meshcolor = 'red'
        cmd.color(meshcolor, 'mesh')
        self.ambientOnly()
        self.assertImageHasColor(meshcolor)

        # continue without map
        cmd.delete('map')

        with testing.mktemp('.pse') as filename:
            cmd.save(filename)

            cmd.delete('*')
            self.assertImageHasNotColor(meshcolor)

            cmd.load(filename)
            self.assertImageHasColor(meshcolor)
开发者ID:schrodinger,项目名称:pymol-testing,代码行数:30,代码来源:PYMOL-2757.py

示例13: testMMTF

    def testMMTF(self):
        '''Styled MMTF export/import'''
        S = 0b10            # 1 << 1 spheres
        D = 0b1000000000    # 1 << 9 dots
        B = 2 # blue
        R = 4 # red

        cmd.fragment('gly')
        cmd.color(B)
        cmd.color(R, 'elem C')
        cmd.show_as('spheres')
        cmd.show_as('dots', 'elem C')

        with testing.mktemp('.mmtf') as filename:
            cmd.save(filename)
            cmd.delete('*')
            cmd.load(filename)

        color_list = []
        reps_list = []

        cmd.iterate('*', 'color_list.append(color)', space=locals())
        cmd.iterate('*', 'reps_list.append(reps)', space=locals())

        self.assertEqual(color_list, [B, R, R, B, B, B, B])
        self.assertEqual(reps_list, [S, D, D, S, S, S, S])
开发者ID:schrodinger,项目名称:pymol-testing,代码行数:26,代码来源:exporting.py

示例14: testRepsExist

    def testRepsExist(self):
        cmd.viewport(200, 150)
        cmd.load(self.datafile('1oky-frag.pdb'), 'm1')

        # make some nonbonded
        cmd.unbond('resi 115-', 'resi 115-')

        # labels
        cmd.label('all', 'name')

        # measurements
        cmd.distance('measure1', 'index 1', 'index 10')
        cmd.angle('measure1', 'index 1', 'index 10', 'index 20')
        cmd.dihedral('measure1', 'index 1', 'index 10', 'index 20', 'index 30')

        # color test setup
        cmd.color('white', '*')
        cmd.set('ambient', 1)
        cmd.set('depth_cue', 0)
        cmd.set('antialias', 0)
        cmd.set('line_smooth', 0)
        cmd.orient()

        # test most reps
        for rep in REPS:
            cmd.show_as(rep)
            self.assertImageHasColor('white', msg='rep missing: ' + rep)

        # test cartoon
        cmd.show_as('cartoon')
        for cart in CARTOONS:
            cmd.cartoon(cart)
            self.assertImageHasColor('white', msg='cartoon missing: ' + cart)
开发者ID:schrodinger,项目名称:pymol-testing,代码行数:33,代码来源:reps.py

示例15: sele2Color

 	def sele2Color(self, sele):
 		globalShader = self.optionMenu_shader.getvalue()

		newShader =  self.seleShaderDict[sele]
		if newShader != globalShader: # should be different from global shader, otherwise do nothing
			newColorInc = ShaderFactory.seleSlot[newShader]


			stored.idcolor_list = set() 
			cmd.iterate(sele, 'stored.idcolor_list.add(int(color))')

			if(len(stored.idcolor_list)>1):
				self.selectionConsole.set('Warning: Selection [%s] contains more than one color.' % sele)

			color = stored.idcolor_list.pop()
			rgb_color = cmd.get_color_tuple(color)

			if rgb_color[2] >= 0.990:
				color_id = '%s %s %s' % (str(rgb_color[0])[0:5].ljust(5, '0'), str(rgb_color[1])[0:5].ljust(5, '0'), str(rgb_color[2]-newColorInc)[0:5])
			else:
				color_id = '%s %s %s' % (str(rgb_color[0])[0:5].ljust(5, '0'), str(rgb_color[1])[0:5].ljust(5, '0'), str(rgb_color[2]+newColorInc)[0:5])

			# color_id from all the sele:shader dictionary
			# determine color_id:shader pair
			if color_id not in self.spColorShaderDict:
				self.spColorShaderDict[color_id] = [newShader, sele]

			# apply new color to atom set
			newRGB = color_id.split(' ')
			newColor = [float(newRGB[0]), float(newRGB[1]), float(newRGB[2])]
			cmd.set_color(color_id, newColor)
			cmd.color(color_id, sele)			

			print 'apply shader [%s] to selection [%s].' % (newShader, sele)			
开发者ID:jkjium,项目名称:kflow,代码行数:34,代码来源:pykflow.py


注:本文中的pymol.cmd.color函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。