def write_current_primers(self,filename='current_order.txt'): """Write currently selected primers to a space-delimited file This is formatted to be uploaded to the MGW website for ordering""" if not filename: print 'no filename given' return if not self.primers.curselection(): print 'primer database is empty or no selection' return # Get currently selected primers into a list tmp_selection=self.primers.curselection() selection=[] for num in tmp_selection: selection.append(int(num)) primers={} first=1 # Now figure out the selected primers and store them in primers for primer_num in selection: name_selected=self.primer_order[primer_num] primers[name_selected]=self.parent.data['primer_dict'][name_selected] #fd=open(filename,'wb') self.DumpPDB = [] import mutation for entry in primers: tmp = [] tmp.append(entry+'_for') tmp.append(' ') tmp.append(primers[entry]['sequence']) reverse=mutation.get_reverse_complementary(primers[entry]['sequence']) tmp.append('\n') tmp.append(entry+'_rev') tmp.append(' ') tmp.append(reverse) tmp.append('\n') self.DumpPDB.append(tmp) try: fd=open(filename,'a') for line in self.DumpPDB: str = '' for S in line: str = str+S fd.write(str+'\n') fd.close() print "File written ",filename except: print "error: could not write file ",filename from PEATDB.textFrame import textFrame self.order_frame = textFrame(self, 'Current primers') self.order_frame.load_text(self.DumpPDB) fd.close() return
def editConfigFile(self): """Edit config file""" from PEATDB.textFrame import textFrame tf = textFrame(parent=self.mainwin, title='PEATSA Conf file') tf.load_from_file(self.confpath) self.parent.wait_window(tf.frame) #reconnect configuration = Core.Environment.Configuration(filename=self.confpath) self.connect(configuration) return