def accept(self): # accept compound and advance if self.object is None: print(" Filter-Error: Please choose an object first") else: state = cmd.get_object_state(self.object) ident = self.get_ident(self.object,state) print(" Filter: Accepting '%s'"%ident) self.count(ident,accept_str) cmd.forward() cmd.refresh_wizard()
def defer(self): # defer compound and advance if self.object is None: print(" Filter-Error: Please choose an object first") else: state = cmd.get_object_state(self.object) ident = self.get_ident(self.object,state) print(" Filter: Deferring '%s'"%ident) self.check_object_dict() self.count(ident,defer_str) cmd.forward() cmd.refresh_wizard()
def get_prompt(self): # returns text prompt self.prompt = None if self.object is None: self.prompt = [ 'Please select a multi-state object...' ] else: self.prompt = [ '%s: %d accepted, %d rejected, %d deferred, %d remaining'%( self.object,self.acce,self.reje,self.defe,self.togo) ] state = cmd.get_object_state(self.object) ident = self.get_ident(self.object,state) sdo=self.dict[self.object] if ident in sdo: self.prompt.append('%s: %s'%(ident,sdo[ident])) else: self.prompt.append('%s?'%(ident)) return self.prompt
def apply(self): cmd=self.cmd if self.status==1: # find the name of the object which contains the selection src_frame = cmd.get_state() try: new_name = cmd.get_object_list(src_sele)[0] except IndexError: print(" Mutagenesis: object not found.") return if True: auto_zoom = cmd.get_setting_text('auto_zoom') cmd.set('auto_zoom',"0",quiet=1) if self.lib_mode!="current": # create copy with mutant in correct frame state = cmd.get_object_state(new_name) cmd.create(tmp_obj2, obj_name, src_frame, state) cmd.set_title(tmp_obj2, state, '') cmd.color(self.stored.identifiers[4], "?%s & elem C" % tmp_obj2) cmd.alter(tmp_obj2, 'ID = -1') # select backbone connection atoms cmd.select(tmp_sele1, 'neighbor ?%s' % (src_sele), 0) # remove residue and neighboring c-cap/n-cap (if any) cmd.remove("?%s | byres (?%s & " "(name N & resn NME+NHH | name C & resn ACE))" % (src_sele, tmp_sele1)) # create the merged molecule cmd.create(new_name, "?%s | ?%s" % (new_name, tmp_obj2), state, state) # now connect them cmd.select(tmp_sele2, '/%s/%s/%s/%s' % ((new_name,) + self.stored.identifiers[:3])) cmd.bond('?%s & name C' % (tmp_sele1), '?%s & name N' % (tmp_sele2), quiet=1) cmd.bond('?%s & name N' % (tmp_sele1), '?%s & name C' % (tmp_sele2), quiet=1) cmd.set_geometry('(?%s | ?%s) & name C+N' % (tmp_sele1, tmp_sele2), 3, 3) # make amide planer # fix N-H hydrogen position (if any exists) cmd.h_fix('?%s & name N' % (tmp_sele2)) # delete temporary objects/selections cmd.delete(tmp_sele1) cmd.delete(tmp_sele2) cmd.delete(tmp_obj2) self.clear() # and return to frame 1 cmd.frame(1) cmd.refresh_wizard() else: # create copy with conformation in correct state cmd.create(tmp_obj2,obj_name,src_frame,1) # remove existing c-cap in copy (if any) cmd.remove("byres (name N and (%s in (neighbor %s)) and resn NME+NHH)"% (new_name,src_sele)) cmd.remove("(%s) and name OXT"%src_sele) # remove existing n-cap in copy (if any) cmd.remove("byres (name C and (%s in (neighbor %s)) and resn ACE)"% (new_name,src_sele)) # save existing conformation on undo stack # cmd.edit("((%s in %s) and name ca)"%(new_name,src_sele)) cmd.push_undo("("+src_sele+")") # modify the conformation cmd.update(new_name,tmp_obj2) # cmd.unpick() cmd.delete(tmp_obj2) self.clear() # and return to frame 1 cmd.frame(1) cmd.refresh_wizard() cmd.set('auto_zoom',auto_zoom,quiet=1)