Ejemplo n.º 1
0
 def testGetTitle(self):
     cmd.fragment('gly', 'm1')
     cmd.create('m1', 'm1', 1, 2)
     title = cmd.get_title('m1', 1)
     self.assertEqual(title, '')
     cmd.set_title('m1', 1, 'foo bar')
     title = cmd.get_title('m1', 1)
     self.assertEqual(title, 'foo bar')
     title = cmd.get_title('m1', 2)
     self.assertEqual(title, '')
     cmd.set_title('m1', 2, 'second state')
     title = cmd.get_title('m1', 2)
     self.assertEqual(title, 'second state')
Ejemplo n.º 2
0
def poke_pymol(self, matrix):
    """Forces PyMOL object to move.

    Argument:
    matrix -- transformation-rotation-transformation matrix in PyMOL format.
    """
    for attached_structure in Registry.objects[self.derived_from].attachment:
        if cmd.get_title(*Registry.get(attached_structure, "name", "state")) == "PD":
            cmd.transform_object(Registry.get(attached_structure, "name"), matrix)
Ejemplo n.º 3
0
 def load_state_dict(self):
     # establish relationship between names and states
     # ASSUMPTION: identifiers will be unique
     self.state_dict = {}
     sd = self.state_dict
     so = self.object
     if so != None:
         cnt = cmd.count_states(so)
         for a in range(1, cnt + 1):
             sd[cmd.get_title(so, a)] = a
Ejemplo n.º 4
0
 def load_state_dict(self):
     # establish relationship between names and states
     # ASSUMPTION: identifiers will be unique
     self.state_dict = {}
     sd = self.state_dict
     so = self.object
     if so != None:
         cnt = cmd.count_states(so)
         for a in range(1, cnt + 1):
             sd[cmd.get_title(so, a)] = a
Ejemplo n.º 5
0
 def accept(self):
     # accept compound and advance
     if self.object == None:
         print " Filter-Error: Please choose an object first"
     else:
         state = cmd.get_state()
         ident = cmd.get_title(self.object, state)
         print " Filter: Accepting '%s'" % ident
         self.count(ident, accept_str)
     cmd.forward()
     cmd.refresh_wizard()
Ejemplo n.º 6
0
 def accept(self):
     # accept compound and advance
     if self.object == None:
         print " Filter-Error: Please choose an object first"
     else:
         state = cmd.get_state()
         ident = cmd.get_title(self.object, state)
         print " Filter: Accepting '%s'" % ident
         self.count(ident, accept_str)
     cmd.forward()
     cmd.refresh_wizard()
Ejemplo n.º 7
0
def _update_transformation(self):
    """Checks if PyMOL object matrix has changed and updates self, if so."""
    try:
        if cmd.get_title(*Registry.get(self.attachment.main_object, "name", "state")) == "PD":
            matrix = cmd.get_object_matrix(Registry.get(self.attachment.main_object, "name"))
            self.reset()
            self.add_rotation([matrix[:3], matrix[4:7], matrix[8:11]])
            self.add_translation([matrix[3], matrix[7], matrix[11]])
            self.add_prerotational_translation(list(matrix[12:15]))
    except AttributeError:
        return
Ejemplo n.º 8
0
 def defer(self):
     # defer compound and advance
     if self.object == None:
         print " Filter-Error: Please choose an object first"
     else:
         state = cmd.get_state()
         ident = cmd.get_title(self.object, state)
         print " Filter: Deferring '%s'" % ident
         self.check_object_dict()
         self.count(ident, defer_str)
     cmd.forward()
     cmd.refresh_wizard()
Ejemplo n.º 9
0
 def defer(self):
     # defer compound and advance
     if self.object == None:
         print " Filter-Error: Please choose an object first"
     else:
         state = cmd.get_state()
         ident = cmd.get_title(self.object, state)
         print " Filter: Deferring '%s'" % ident
         self.check_object_dict()
         self.count(ident, defer_str)
     cmd.forward()
     cmd.refresh_wizard()
Ejemplo n.º 10
0
    def get_prompt(self):

        # returns text prompt

        self.prompt = None
        if self.object == None:
            self.prompt = ["Please select a multi-state object..."]
        else:
            cnt = cmd.count_states(self.object)
            self.prompt = [
                "%s: %d total, %d accepted, %d rejected, %d deferred, %d remaining"
                % (self.object, self.tota, self.acce, self.reje, self.defe, self.togo)
            ]
            state = cmd.get_state()
            ident = cmd.get_title(self.object, state)
            sdo = self.dict[self.object]
            if sdo.has_key(ident):
                self.prompt.append("%s: %s" % (ident, sdo[ident]))
            else:
                self.prompt.append("%s?" % (ident))
        return self.prompt
Ejemplo n.º 11
0
    def get_prompt(self):

        # returns text prompt

        self.prompt = None
        if self.object == None:
            self.prompt = ['Please select a multi-state object...']
        else:
            cnt = cmd.count_states(self.object)
            self.prompt = [
                '%s: %d total, %d accepted, %d rejected, %d deferred, %d remaining'
                % (self.object, self.tota, self.acce, self.reje, self.defe,
                   self.togo)
            ]
            state = cmd.get_state()
            ident = cmd.get_title(self.object, state)
            sdo = self.dict[self.object]
            if sdo.has_key(ident):
                self.prompt.append('%s: %s' % (ident, sdo[ident]))
            else:
                self.prompt.append('%s?' % (ident))
        return self.prompt
Ejemplo n.º 12
0
 def test_set_title(self):
     text = 'foo'
     cmd.pseudoatom('m1')
     cmd.set_title('m1', 1, text)
     self.assertEqual(cmd.get_title('m1', 1), text)
Ejemplo n.º 13
0
 def test_set_title(self):
     text = 'foo'
     cmd.pseudoatom('m1')
     cmd.set_title('m1', 1, text)
     self.assertEqual(cmd.get_title('m1', 1), text)