PEATDB/DNAtool/primer_database.py
def load_from_text(self,overwrite=1):
        """Load a new primer database from a csv text file"""

        initialdir=os.getcwd()
        filename=tkFileDialog.askopenfilename(defaultextension='pdb.csv',
                                              initialdir=initialdir,
                                              filetypes=[("Text files","*.csv"),
                                                         ("All files","*.*")])
        if not filename:
            return
        pdict={}
        reader = csv.reader(open(filename, "rb"))
        for row in reader:
            try:
                primer=row[0]
                pdict[primer]={'description':row[1],'sequence':row[2]}
            except:
                print 'failed to load'

        # Should we overwrite the existing primers?
        if overwrite:
            import tkMessageBox
            if tkMessageBox.askyesno("Overwrite primer database?",
                                     "This will overwrite all primers you have in the primer datbase.\nAre you sure you want to continue?"):
                self.parent.data['primer_dict']=pdict.copy()
                self.show_pDB_contents()
        return pdict
Load a new primer database from a csv text file
Load a new primer database from a csv text file
Load a new primer database from a csv text file
def load_from_text(self,overwrite=1):
        initialdir=os.getcwd()
        filename=tkFileDialog.askopenfilename(defaultextension='pdb.csv',
                                              initialdir=initialdir,
                                              filetypes=[("Text files","*.csv"),
                                                         ("All files","*.*")])
        if not filename:
            return
        pdict={}
        reader = csv.reader(open(filename, "rb"))
        for row in reader:
            try:
                primer=row[0]
                pdict[primer]={'description':row[1],'sequence':row[2]}
            except:
                print 'failed to load'
        if overwrite:
            import tkMessageBox
            if tkMessageBox.askyesno("Overwrite primer database?",
                                     "This will overwrite all primers you have in the primer datbase.\nAre you sure you want to continue?"):
                self.parent.data['primer_dict']=pdict.copy()
                self.show_pDB_contents()
        return pdict
def load_from_text ( self , overwrite = 1 ) : initialdir = os . getcwd ( ) filename = tkFileDialog . askopenfilename ( defaultextension = 'pdb.csv' , initialdir = initialdir , filetypes = [ ( "Text files" , "*.csv" ) , ( "All files" , "*.*" ) ] ) if not filename : return pdict = { } reader = csv . reader ( open ( filename , "rb" ) ) for row in reader : try : primer = row [ 0 ] pdict [ primer ] = { 'description' : row [ 1 ] , 'sequence' : row [ 2 ] } except : print 'failed to load' if overwrite : import tkMessageBox if tkMessageBox . askyesno ( "Overwrite primer database?" , "This will overwrite all primers you have in the primer datbase.\nAre you sure you want to continue?" ) : self . parent . data [ 'primer_dict' ] = pdict . copy ( ) self . show_pDB_contents ( ) return pdict
Load a new primer database from a csv text file
Load a new primer database from a csv text file
"""Load a new primer database from a csv text file""" # Should we overwrite the existing primers?
self
overwrite