コード例 #1
0
ファイル: demo.py プロジェクト: Almad/pymol
    def reps(self,cleanup=0):
        rep_list = [ "lines","sticks","spheres","surface","mesh","dots","ribbon","cartoon" ]
        try:
            if not cleanup:
                self.cmd.disable()
                self.cmd.set("suspend_updates",1,quiet=1)
                self.cmd.mset()
                self.cmd.unset("movie_panel")
                self.cmd.load("$PYMOL_DATA/demo/pept.pdb","rep1")
                self.cmd.alter("rep1///1-5+8-13/","ss='S'")
                self.cmd.cartoon("auto")
                self.cmd.hide("everything","rep1")
                for a in range(2,9):
                    self.cmd.create("rep%d"%a,"rep1")
                map(lambda x,y,s=self:s.cmd.show(x,"rep%d"%y),
                     rep_list,
                     range(1,9))
                self.cmd.reset()
                self.cmd.zoom("rep1",24)
                util.cbay("rep2",_self=self.cmd)
                util.cbac("rep3",_self=self.cmd)
                util.cbas("rep4",_self=self.cmd)
                util.cbab("rep5",_self=self.cmd)
                util.cbaw("rep6",_self=self.cmd)            
                util.cbay("rep8",_self=self.cmd)


                self.cmd.set("suspend_updates",0,quiet=1)
                scale=0.5
                for b in range(1,20):
                    self.cmd.set("suspend_updates",0,quiet=1)
                    self.cmd.refresh()
                    self.cmd.set("suspend_updates",1,quiet=1)
                    xt=-3.2
                    yt=1.6
                    for a in range(1,5):
                        self.cmd.translate([xt*scale,yt*scale,0],object="rep%d"%a,camera=0)
                        xt=xt+2
                    yt=-yt
                    xt=-3.2
                    for a in range(5,9):
                        self.cmd.translate([xt*scale,yt*scale,0],object="rep%d"%a,camera=0)
                        xt=xt+2
                for a in range(1,9):
                    self.cmd.origin("rep%d"%a,object="rep%d"%a)
                self.cmd.mset("1")
                st = string.join(map(lambda x,y:"rotate angle=-3,object=rep%d,axis=%s;"%(x,y),range(1,9),
                                            ['x','y','x','y','x','y','x','y']))
                self.cmd.mdo(1,st)
                self.cmd.set("suspend_updates",0,quiet=1)
                self.cmd.mplay()

                cgo = []
                axes = [[4.5,0.0,0.0],[0.0,3.0,0.0],[0.0,0.0,3.0]]

                c = 1
                for a in rep_list:
                    ext = self.cmd.get_extent("rep%d"%c)
                    pos = [(ext[0][0]+ext[1][0])/2,
                             (ext[0][1]+ext[1][1])/2+14,
                             (ext[0][2]+ext[1][2])/2]
                    c = c + 1
                    pos[0]=pos[0]-(measure_text(plain,a,axes)/2)
                    wire_text(cgo,plain,pos,a,axes)
                self.cmd.set("cgo_line_width",1.5)
                self.cmd.set("auto_zoom",0)
                self.cmd.load_cgo(cgo,'reps')
                self.cmd.set("auto_zoom",1)
            else:
                self.cmd.delete("rep*")
                self.cmd.mset()
                self.cmd.mstop()
                self.cmd.set("movie_panel",1)
        except:
            traceback.print_exc()
コード例 #2
0
    def reps(self, cleanup=0):
        rep_list = [
            "lines", "sticks", "spheres", "surface", "mesh", "dots", "ribbon",
            "cartoon"
        ]
        try:
            if not cleanup:
                self.cmd.disable()
                self.cmd.set("suspend_updates", 1, quiet=1)
                self.cmd.mset()
                self.cmd.set("movie_panel", 0)
                self.cmd.load("$PYMOL_DATA/demo/pept.pdb", "rep1")
                self.cmd.alter("rep1///1-5+8-13/", "ss='S'")
                self.cmd.cartoon("auto")
                self.cmd.hide("everything", "rep1")
                for a in range(2, 9):
                    self.cmd.create("rep%d" % a, "rep1")
                for y, x in enumerate(rep_list, 1):
                    self.cmd.show(x, "rep%d" % y)
                self.cmd.reset()
                self.cmd.zoom("rep1", 24)
                util.cbay("rep2", _self=self.cmd)
                util.cbac("rep3", _self=self.cmd)
                util.cbas("rep4", _self=self.cmd)
                util.cbab("rep5", _self=self.cmd)
                util.cbaw("rep6", _self=self.cmd)
                util.cbay("rep8", _self=self.cmd)

                self.cmd.set("suspend_updates", 0, quiet=1)
                scale = 0.5
                for b in range(1, 20):
                    self.cmd.set("suspend_updates", 0, quiet=1)
                    self.cmd.refresh()
                    self.cmd.set("suspend_updates", 1, quiet=1)
                    xt = -3.2
                    yt = 1.6
                    for a in range(1, 5):
                        self.cmd.translate([xt * scale, yt * scale, 0],
                                           object="rep%d" % a,
                                           camera=0)
                        xt = xt + 2
                    yt = -yt
                    xt = -3.2
                    for a in range(5, 9):
                        self.cmd.translate([xt * scale, yt * scale, 0],
                                           object="rep%d" % a,
                                           camera=0)
                        xt = xt + 2
                for a in range(1, 9):
                    self.cmd.origin("rep%d" % a, object="rep%d" % a)
                self.cmd.mset("1")
                st = ' '.join("rotate angle=-3,object=rep%d,axis=%s;" %
                              (x, 'yx'[x % 2]) for x in range(1, 9))
                self.cmd.mdo(1, st)
                self.cmd.set("suspend_updates", 0, quiet=1)
                self.cmd.mplay()

                cgo = []
                axes = [[4.5, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 3.0]]

                c = 1
                for a in rep_list:
                    ext = self.cmd.get_extent("rep%d" % c)
                    pos = [(ext[0][0] + ext[1][0]) / 2,
                           (ext[0][1] + ext[1][1]) / 2 + 14,
                           (ext[0][2] + ext[1][2]) / 2]
                    c = c + 1
                    pos[0] = pos[0] - (measure_text(plain, a, axes) / 2)
                    wire_text(cgo, plain, pos, a, axes)
                self.cmd.set("cgo_line_width", 1.5)
                self.cmd.set("auto_zoom", 0)
                self.cmd.load_cgo(cgo, 'reps')
                self.cmd.set("auto_zoom", 1)
            else:
                self.cmd.delete("rep*")
                self.cmd.mset()
                self.cmd.mstop()
                self.cmd.set("movie_panel", 1)
        except:
            traceback.print_exc()
コード例 #3
0
ファイル: demo.py プロジェクト: Clayton-Toste/Surface-Anaysis
    def reps(self, cleanup=0):
        rep_list = [
            "lines", "sticks", "spheres", "surface", "mesh", "dots", "ribbon",
            "cartoon"
        ]
        suspend_undo = self.cmd.get("suspend_undo")
        self.cmd.set("suspend_undo", 1, updates=0)
        try:
            if not cleanup:
                self.cmd.disable()
                self.cmd.set("suspend_updates", 1, quiet=1)
                self.cmd.mset()
                self.cmd.set("movie_panel", 0)
                self.cmd.load("$PYMOL_DATA/demo/pept.pdb", "rep1")
                self.cmd.alter("rep1///1-5+8-13/", "ss='S'")
                self.cmd.cartoon("auto")
                self.cmd.hide("everything", "rep1")
                for a in range(2, 9):
                    self.cmd.create("rep%d" % a, "rep1")
                for y, x in enumerate(rep_list, 1):
                    self.cmd.show(x, "rep%d" % y)
                self.cmd.reset()
                self.cmd.zoom("rep1", 24)
                util.cbay("rep2", _self=self.cmd)
                util.cbac("rep3", _self=self.cmd)
                util.cbas("rep4", _self=self.cmd)
                util.cbab("rep5", _self=self.cmd)
                util.cbaw("rep6", _self=self.cmd)
                util.cbay("rep8", _self=self.cmd)

                self.cmd.set("suspend_updates", 0, quiet=1)
                scale = 0.5
                for b in range(1, 20):
                    self.cmd.set("suspend_updates", 0, quiet=1)
                    self.cmd.refresh()
                    self.cmd.set("suspend_updates", 1, quiet=1)
                    xt = -3.2
                    yt = 1.4
                    for a in range(1, 5):
                        self.cmd.translate([xt * scale, yt * scale, 0],
                                           object="rep%d" % a,
                                           camera=0)
                        xt = xt + 2
                    yt = -2.
                    xt = -3.2
                    for a in range(5, 9):
                        self.cmd.translate([xt * scale, yt * scale, 0],
                                           object="rep%d" % a,
                                           camera=0)
                        xt = xt + 2
                for a in range(1, 9):
                    self.cmd.origin("rep%d" % a, object="rep%d" % a)
                self.cmd.mset("1")
                st = ' '.join("rotate angle=-3,object=rep%d,axis=%s;" %
                              (x, 'yx'[x % 2]) for x in range(1, 9))
                self.cmd.mdo(1, st)
                self.cmd.set("suspend_updates", 0, quiet=1)
                self.cmd.mplay()

                axes = [[4.5, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 3.0]]
                c = 1
                self.cmd.set("suspend_updates", 1, quiet=1)
                for a in rep_list:
                    ext = self.cmd.get_extent("rep%d" % c)
                    pos = [(ext[0][0] + ext[1][0]) / 2,
                           (ext[0][1] + ext[1][1]) / 2 + 16,
                           (ext[0][2] + ext[1][2]) / 2]
                    c = c + 1
                    self.cmd.pseudoatom("reps", label=str(a), pos=pos)
                self.cmd.set("label_size", 24, "reps")
                self.cmd.set("suspend_updates", 0, quiet=1)
            else:
                self.cmd.delete("rep*")
                self.cmd.mset()
                self.cmd.mstop()
                self.cmd.set("movie_panel", 1)
        except cmd.QuietException:
            # in case of hopping to the next demo
            pass
        except:
            traceback.print_exc()
        finally:
            self.cmd.set("suspend_updates", 0, quiet=1)
            self.cmd.set("suspend_undo", suspend_undo, updates=0)