pKaTool/pKa_system_file_menu.py
def load_titdb(self, filename = '', acid_bases = None):
        """Read titration curves from a titdb exported file - added by damien"""
        import tkFileDialog, os
        savedir=os.getcwd()
        if filename == '':
            filename=tkFileDialog.askopenfilename(defaultextension="*.tcrv",
                                                  initialdir=savedir,
                                                  filetypes=[("CSV file",".csv"),
                                                             ("All files","*.*")])
        if filename:
            import csv
            if os.path.isfile(filename):
                # Read the file
                csvfile = open(filename)
                reader = csv.reader(csvfile)
                local_titration_data={}
                for row in reader:
                    if len(row)==1: #dataset name
                        current = row[0]
                        local_titration_data[current]={}
                    else:
                        ph=float(row[0]); val=float(row[1])
                        local_titration_data[current][ph]=val

                print local_titration_data

                self.convert_titration_data(local_titration_data, acid_bases=acid_bases)
            else:
                import tkMessageBox
                tkMessageBox.showwarning('File does not exist',
                                         'Could not find %s.' %filename)
        return
Read titration curves from a titdb exported file - added by damien
Read titration curves from a titdb exported file - added by damien
Read titration curves from a titdb exported file - added by damien
def load_titdb(self, filename = '', acid_bases = None):
        import tkFileDialog, os
        savedir=os.getcwd()
        if filename == '':
            filename=tkFileDialog.askopenfilename(defaultextension="*.tcrv",
                                                  initialdir=savedir,
                                                  filetypes=[("CSV file",".csv"),
                                                             ("All files","*.*")])
        if filename:
            import csv
            if os.path.isfile(filename):
                csvfile = open(filename)
                reader = csv.reader(csvfile)
                local_titration_data={}
                for row in reader:
                    if len(row)==1: 
                        current = row[0]
                        local_titration_data[current]={}
                    else:
                        ph=float(row[0]); val=float(row[1])
                        local_titration_data[current][ph]=val
                print local_titration_data
                self.convert_titration_data(local_titration_data, acid_bases=acid_bases)
            else:
                import tkMessageBox
                tkMessageBox.showwarning('File does not exist',
                                         'Could not find %s.' %filename)
        return
def load_titdb ( self , filename = '' , acid_bases = None ) : import tkFileDialog , os savedir = os . getcwd ( ) if filename == '' : filename = tkFileDialog . askopenfilename ( defaultextension = "*.tcrv" , initialdir = savedir , filetypes = [ ( "CSV file" , ".csv" ) , ( "All files" , "*.*" ) ] ) if filename : import csv if os . path . isfile ( filename ) : csvfile = open ( filename ) reader = csv . reader ( csvfile ) local_titration_data = { } for row in reader : if len ( row ) == 1 : current = row [ 0 ] local_titration_data [ current ] = { } else : ph = float ( row [ 0 ] ) ; val = float ( row [ 1 ] ) local_titration_data [ current ] [ ph ] = val print local_titration_data self . convert_titration_data ( local_titration_data , acid_bases = acid_bases ) else : import tkMessageBox tkMessageBox . showwarning ( 'File does not exist' , 'Could not find %s.' % filename ) return
Read titration curves from a titdb exported file - added by damien
Read titration curves from a titdb exported file - added by damien
"""Read titration curves from a titdb exported file - added by damien""" # Read the file #dataset name
self
filename
acid_bases