def testIsomesh(self): cmd.viewport(100, 100) 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') cmd.isomesh('mesh', 'map', source_state=1, state=-2) ## check mesh presence by color meshcolor = 'red' cmd.color(meshcolor, 'mesh') self.ambientOnly() self.assertImageHasColor(meshcolor) cmd.frame(2) self.assertEqual(cmd.get_state(), 2) self.assertImageHasColor(meshcolor) with testing.mktemp('.pse') as filename: cmd.save(filename) cmd.delete('*') self.assertImageHasNotColor(meshcolor) cmd.load(filename) self.assertImageHasColor(meshcolor) cmd.frame(2) self.assertEqual(cmd.get_state(), 2) self.assertImageHasColor(meshcolor)
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)
def mesh_ribbon(): cmd.hide('everything') glb.update() cmd.map_new('map', "gaussian", "0.75", 'all') glb.procolor(None,show_all=('lines','ribbon'),color_all='red') cmd.isomesh('map1', 'map', '1') cmd.color('purple','map1')
def mesh_ribbon(): cmd.hide('everything') glb.update() cmd.map_new('map', "gaussian", "0.75", 'all') glb.procolor(None, show_all=('lines', 'ribbon'), color_all='red') cmd.isomesh('map1', 'map', '1') cmd.color('purple', 'map1')
def test(self): cmd.viewport(100,100) cmd.set('gaussian_b_floor', 20) cmd.set('ambient', 1) cmd.set('specular', 0) cmd.set('mesh_color', 'blue') cmd.set('dot_color', 'green') cmd.fragment('gly') cmd.map_new('map1') cmd.disable('*') cmd.isomesh('o1', 'map1') cmd.color('red', 'o1') cmd.show('cell') self._check_colors('red', 'blue') cmd.delete('o1') cmd.isodot('o1', 'map1') cmd.color('red', 'o1') self._check_colors('green') cmd.delete('o1') cmd.gradient('o1', 'map1') cmd.color('yellow', 'o1') self._check_colors('yellow') cmd.delete('o1')
def update(self): self.center = cmd.get_position() cmd.alter_state(0, self.center_name, "(x, y, z) = p", space={'p': self.center}) cmd.isomesh(self.name, self.map_name, self.level, self.center_name, carve=self.radius)
def emesh(event): delcrea() try: if len(nameit.get()) < 1: showinfo("Error", 'Enter a name for the object') interior.mainloop() elif len(pdbname.get()) < 1: showinfo('Error', "Enter the Map Filename") interior.mainloop() else: cmd.isomesh(nameit.get(), pdbname.get(), contour1.get()) except: showinfo("Error", 'No map is present') interior.mainloop()
def roving_density(self, cleanup=0): if not cleanup: try: cmd.load("$PYMOL_DATA/demo/il2.pdb") cmd.set("suspend_updates", 1, quiet=1) cmd.remove("hydro") cmd.disable() cmd.enable("il2") cmd.map_new("map", "gaussian", "0.75", "il2") cmd.feedback("disable", "objectmesh", "actions") cmd.set("ribbon_color", "purple", "il2") cmd.set("roving_detail", 1) cmd.set("roving_origin", 1) cmd.set("stick_radius", 0.12, "il2") cmd.set("roving_sticks", 0) cmd.set("roving_polar_contacts", 0) cmd.set("line_width", "3") cmd.set("roving_map1_name", "map") cmd.isomesh("rov_m1", "map", 9999.0, "il2") cmd.color("density", "rov_m1") cmd.set_view ((\ 0.132852688, -0.729740858, 0.670686543,\ -0.228543565, 0.635894477, 0.737154961,\ -0.964425683, -0.251212329, -0.082298420,\ 0.000062190, 0.000183226, -58.861488342,\ 13.349151611, -1.565427899, 22.383148193,\ 55.259441376, 63.259449005, 0.000000000 )) finally: cmd.set("suspend_updates", 0, quiet=1) cmd.refresh() else: cmd.set("roving_detail", 0) cmd.set("roving_map1_name", "") cmd.set("roving_polar_contacts", 7) cmd.set("roving_sticks", 6) cmd.delete("il2") cmd.delete("map") cmd.set("line_width", 1.5) cmd.refresh() cmd.set("roving_detail", 0) cmd.delete("rov_*") cmd.sync()
def emesh1(event): delcrea() try: cmd.isomesh('map1','map', contour1.get(), 'sele') except: try: cmd.remove("hydro") cmd.enable('all') cmd.map_new('map',"gaussian","0.75", 'all') cmd.isomesh('map1','map', contour1.get(), 'sele') except: cmd.orient('all') showinfo("Error", 'No PDB is present\nOr there is no selection ('"sele"')') interior.mainloop()
def roving_density(self,cleanup=0): if not cleanup: try: cmd.load("$PYMOL_DATA/demo/il2.pdb") cmd.set("suspend_updates",1,quiet=1) cmd.remove("hydro") cmd.disable() cmd.enable("il2") cmd.map_new("map","gaussian","0.75","il2") cmd.feedback("disable","objectmesh","actions") cmd.set("ribbon_color","purple","il2") cmd.set("roving_detail",1) cmd.set("roving_origin",1) cmd.set("stick_radius",0.12,"il2") cmd.set("roving_sticks",0) cmd.set("roving_polar_contacts",0) cmd.set("line_width","3") cmd.set("roving_map1_name","map") cmd.isomesh("rov_m1","map",9999.0,"il2") cmd.color("density","rov_m1") cmd.set_view ((\ 0.132852688, -0.729740858, 0.670686543,\ -0.228543565, 0.635894477, 0.737154961,\ -0.964425683, -0.251212329, -0.082298420,\ 0.000062190, 0.000183226, -58.861488342,\ 13.349151611, -1.565427899, 22.383148193,\ 55.259441376, 63.259449005, 0.000000000 )) finally: cmd.set("suspend_updates",0,quiet=1) cmd.refresh() else: cmd.set("roving_detail",0) cmd.set("roving_map1_name","") cmd.set("roving_polar_contacts",7) cmd.set("roving_sticks",6) cmd.delete("il2") cmd.delete("map") cmd.set("line_width",1.5) cmd.refresh() cmd.set("roving_detail",0) cmd.delete("rov_*") cmd.sync()
def emesh(event): delcrea() try: if len(nameit.get()) < 1: showinfo("Error", 'Enter a name for the object') interior.mainloop() elif len(pdbname.get()) < 1: showinfo('Error', "Enter the Map Filename") interior.mainloop() else: cmd.isomesh(nameit.get(),pdbname.get(), contour1.get()) except: showinfo("Error", 'No map is present') interior.mainloop()
def emesh1(*args): delcrea() try: if len(nameit.get()) < 1: showinfo("Error", 'Enter a name for the object') interior.mainloop() elif len(pdbname.get()) < 1: showinfo('Error', "Enter the Map Filename") interior.mainloop() else: cmd.isomesh(nameit.get(), pdbname.get(), contour1.get(), ('sele')) except: cmd.orient('all') showinfo("Error", 'No map is present\n Or there is no selection ("sele")') interior.mainloop()
def emesh1(event): delcrea() try: cmd.isomesh('map1', 'map', contour1.get(), 'sele') except: try: cmd.remove("hydro") cmd.enable('all') cmd.map_new('map', "gaussian", "0.75", 'all') cmd.isomesh('map1', 'map', contour1.get(), 'sele') except: cmd.orient('all') showinfo( "Error", 'No PDB is present\nOr there is no selection (' "sele" ')') interior.mainloop()
def show_map(unit_cell, map_covering_unit_cell, label, level): map_grid = map_covering_unit_cell.focus() print "map_grid:", map_grid ucell_params = unit_cell.parameters() first = [0, 0, 0] last = [map_grid[i] + 1 for i in xrange(3)] c_obj_map = maptbx.as_CObjectZYX(map_unit_cell=map_covering_unit_cell, first=first, last=last, apply_sigma_scaling=True) map = Map() map.from_c_object(c_obj_map, 'CObjectZYXfloat', ucell_params[0:3], ucell_params[3:6], list(map_grid), first, last) cmd.load_map(map, label + "_cell") print "map loaded into PyMol" cmd.isomesh(label + "_con", label + "_cell", level) # create mesh cmd.color('gray', label + "_cell") # color wire frame cmd.set('auto_zoom', '0') # disable zooming cmd.set('ortho', '1') # orthoscopic projects cmd.enable(label + "_cell") # put box around map object cmd.color('cyan', label + "_con") # color mesh
def emesh1(*args): delcrea() try: if len(nameit.get()) < 1: showinfo("Error", 'Enter a name for the object') interior.mainloop() elif len(pdbname.get()) < 1: showinfo('Error', "Enter the Map Filename") interior.mainloop() else: cmd.isomesh(nameit.get(),pdbname.get(), contour1.get(), ('sele')) except: cmd.orient('all') showinfo("Error", 'No map is present\n Or there is no selection ("sele")') interior.mainloop()
def show_map(unit_cell, map_covering_unit_cell, label, level): map_grid = map_covering_unit_cell.focus() print "map_grid:", map_grid ucell_params = unit_cell.parameters() first = [0,0,0] last = [map_grid[i] + 1 for i in xrange(3)] c_obj_map = maptbx.as_CObjectZYX( map_unit_cell=map_covering_unit_cell, first=first, last=last, apply_sigma_scaling=True) map=Map() map.from_c_object(c_obj_map,'CObjectZYXfloat', ucell_params[0:3], ucell_params[3:6], list(map_grid), first, last) cmd.load_map(map, label+"_cell") print "map loaded into PyMol" cmd.isomesh(label+"_con", label+"_cell", level) # create mesh cmd.color('gray', label+"_cell") # color wire frame cmd.set('auto_zoom', '0') # disable zooming cmd.set('ortho', '1') # orthoscopic projects cmd.enable(label+"_cell") # put box around map object cmd.color('cyan', label+"_con") # color mesh
def roving_density(): delcrea() try: cmd.set("suspend_updates", 1, quiet=1) cmd.remove("hydro") cmd.disable() cmd.enable('all') cmd.map_new('map', "gaussian", "0.75", 'all') cmd.set('roving_isomesh', rovingradius1.get()) cmd.set("roving_detail", 1) cmd.set("stick_radius", 0.5) cmd.set("roving_sticks", 0) cmd.set('roving_lines', rovingradius1.get()) cmd.set("roving_polar_contacts", 0) cmd.set("line_width", "3") cmd.set("roving_map1_name", 'map') cmd.isomesh("map1", "map", 9999.0, 'all') cmd.set("suspend_updates", 0, quiet=1) cmd.refresh() cmd.delete('rov_s1') cmd.set('roving_isosurface', 0) except: showinfo("Error", 'No PDB is present') interior.mainloop()
def roving_density(): delcrea() try: cmd.set("suspend_updates",1,quiet=1) cmd.remove("hydro") cmd.disable() cmd.enable('all') cmd.map_new('map',"gaussian","0.75", 'all') cmd.set('roving_isomesh', rovingradius1.get()) cmd.set("roving_detail",1) cmd.set("stick_radius",0.5) cmd.set("roving_sticks",0) cmd.set('roving_lines', rovingradius1.get()) cmd.set("roving_polar_contacts",0) cmd.set("line_width","3") cmd.set("roving_map1_name",'map') cmd.isomesh("map1", "map", 9999.0, 'all') cmd.set("suspend_updates",0,quiet=1) cmd.refresh() cmd.delete('rov_s1') cmd.set('roving_isosurface',0) except: showinfo("Error", 'No PDB is present') interior.mainloop()
def emesh(*args): delcrea() try: cmd.isomesh('map1', 'map', contour1.get()) except: try: cmd.set("suspend_updates", 1, quiet=1) cmd.remove("hydro") cmd.enable('all') cmd.map_new('map', "gaussian", "0.75", 'all') cmd.isomesh("map1", "map", 9999.0, 'all') cmd.set("suspend_updates", 0, quiet=1) cmd.isomesh('map1', 'map', contour1.get()) cmd.refresh() except: showinfo("Error", 'No PDB is present') interior.mainloop()
def emesh(*args): delcrea() try: cmd.isomesh('map1','map', contour1.get()) except: try: cmd.set("suspend_updates",1,quiet=1) cmd.remove("hydro") cmd.enable('all') cmd.map_new('map',"gaussian","0.75", 'all') cmd.isomesh("map1", "map", 9999.0, 'all') cmd.set("suspend_updates",0,quiet=1) cmd.isomesh('map1','map', contour1.get()) cmd.refresh() except: showinfo("Error", 'No PDB is present') interior.mainloop()
cmd.load(f, 'label_threshold_8.35000038147') cmd.hide('everything', 'label_threshold_8.35000038147') cmd.label("label_threshold_8.35000038147", "name") cmd.set("label_font_id", 7) cmd.set("label_size", -0.4) cmd.group('Pharmacophore_8.35000038147', members='label_threshold_8.35000038147') if dirpath: f = join(dirpath, '0/mesh.grd') else: f = '0/mesh.grd' cmd.load(f, 'mesh_0') cmd.isomesh("isomesh_0", "mesh_0", 0.9) cmd.color("grey80", "isomesh_0") cmd.set('transparency', 0.4, "isomesh_0") cmd.group('hotspot_0', "isomesh_0") cmd.group('hotspot_0', "mesh_0") if dirpath: f = join(dirpath, "1/label_threshold_13.1.mol2") else: f = "1/label_threshold_13.1.mol2" cmd.load(f, 'label_threshold_13.1') cmd.hide('everything', 'label_threshold_13.1') cmd.label("label_threshold_13.1", "name") cmd.set("label_font_id", 7)
def _make_mesh(self, oname): mapname = oname + '_map' self._make_map(mapname) cmd.isomesh(oname, mapname)
cmd.load_mtz(reflectionFile, prefix='my_map' ) #, amplitudes = 'unknown/unknown291019/REFM_FWT', #phases = 'unknown/unknown291019/REFM_PHWT',reso_low = 23.96, reso_high = 1.9) #cmd.map_double("my_map") cmd.map_double("my_map.2fofc") print("upload finished") cmd.hide("everything") cmd.show("sticks") cmd.set_bond('stick_radius', '0.1', 'overall_best') cmd.center() cmd.select('site', 'br. all within ' + str(radius_check) + ' of center') cmd.isomesh('map', 'my_map.2fofc', 1.0, 'site', carve=1.6) cmd.color('gray40', 'map') cmd.set('mesh_width', '0.1') cmd.bg_color('white') cmd.set("ray_trace_fog", "0") cmd.set("depth_cue", "0") cmd.set("ray_shadows", "off") cmd.ray(1024, 1024) cmd.show("mesh", "map") cmd.zoom('site')
f = "0\label_threshold_rank_1.mol2" cmd.load(f, 'label_threshold_rank_1') cmd.hide('everything', 'label_threshold_rank_1') cmd.label("label_threshold_rank_1", "name") cmd.set("label_font_id", 7) cmd.set("label_size", -0.4) cmd.group('Pharmacophore_rank_1', members='label_threshold_rank_1') if dirpath: f = join(dirpath, '0\mesh.grd') else: f = '0\mesh.grd' cmd.load(f, 'mesh_0') cmd.isomesh("isomesh_0", "mesh_0", 0.9) cmd.color("grey80", "isomesh_0") cmd.set('transparency', 0.4, "isomesh_0") cmd.group('hotspot_0', "isomesh_0") cmd.group('hotspot_0', "mesh_0") if dirpath: f = join(dirpath, "1\label_threshold_15.2.mol2") else: f = "1\label_threshold_15.2.mol2" cmd.load(f, 'label_threshold_15.2') cmd.hide('everything', 'label_threshold_15.2') cmd.label("label_threshold_15.2", "name") cmd.set("label_font_id", 7)