PEATDB/Ekin/IO.py
def import_chem_shift(self,event=None):
        """Import kinetic data from a nmr file"""

        import tkFileDialog
        filename=tkFileDialog.askopenfilename(defaultextension='.txt',initialdir=self.savedir,
                                              filetypes=[("NMR file","*.txt"),
                                                         ("All files","*.*")],
                                              parent=self.ekin_win)
        if os.path.isfile(filename):
            fd=open(filename)

            line = fd.readline()
            line = line.strip('\t\n')
            residues = line.split()
            values = []
            while len(line)>2:
                line = fd.readline()
                line = line.strip('\t\n')
                lvalues = line.split()
                values.append(lvalues)
            fd.close()
            data = {}

            for r in range(1,len(residues)):
                data[residues[r]]={}

            for i in range(1,len(values)):
                for j in range(1,len(values[i])):
                    #print values[i][0]
                    pH = values[i][0]
                    res = residues[j]
                    print 'data[%s][%s] = %s'%(res,pH,values[i][j])
                    data[residues[j]][pH]=values[i][j]

            #
            # Insert the data if it's not already there
            #
            tabnames=self.nb.pagenames()
            for residue in data.keys():
                dps=len(data[residue].keys())
                self.reprint_parameters()
                if not residue in tabnames:
                    newtab_num=self.add_datalist(residue,data_points=dps)
                    count=0
                    for pH in data[residue].keys():
                        self.data[newtab_num][0][count]['var'].set(pH)
                        self.data[newtab_num][1][count]['var'].set(data[residue][pH])
                        count=count+1
            #self.redraw_graph(fitting=1)
        return
Import kinetic data from a nmr file
Import kinetic data from a nmr file
Import kinetic data from a nmr file
def import_chem_shift(self,event=None):
        import tkFileDialog
        filename=tkFileDialog.askopenfilename(defaultextension='.txt',initialdir=self.savedir,
                                              filetypes=[("NMR file","*.txt"),
                                                         ("All files","*.*")],
                                              parent=self.ekin_win)
        if os.path.isfile(filename):
            fd=open(filename)
            line = fd.readline()
            line = line.strip('\t\n')
            residues = line.split()
            values = []
            while len(line)>2:
                line = fd.readline()
                line = line.strip('\t\n')
                lvalues = line.split()
                values.append(lvalues)
            fd.close()
            data = {}
            for r in range(1,len(residues)):
                data[residues[r]]={}
            for i in range(1,len(values)):
                for j in range(1,len(values[i])):
                    pH = values[i][0]
                    res = residues[j]
                    print 'data[%s][%s] = %s'%(res,pH,values[i][j])
                    data[residues[j]][pH]=values[i][j]
             Insert the data if it's not already there
            tabnames=self.nb.pagenames()
            for residue in data.keys():
                dps=len(data[residue].keys())
                self.reprint_parameters()
                if not residue in tabnames:
                    newtab_num=self.add_datalist(residue,data_points=dps)
                    count=0
                    for pH in data[residue].keys():
                        self.data[newtab_num][0][count]['var'].set(pH)
                        self.data[newtab_num][1][count]['var'].set(data[residue][pH])
                        count=count+1
            self.redraw_graph(fitting=1)
        return
def import_chem_shift ( self , event = None ) : import tkFileDialog filename = tkFileDialog . askopenfilename ( defaultextension = '.txt' , initialdir = self . savedir , filetypes = [ ( "NMR file" , "*.txt" ) , ( "All files" , "*.*" ) ] , parent = self . ekin_win ) if os . path . isfile ( filename ) : fd = open ( filename ) line = fd . readline ( ) line = line . strip ( '\t\n' ) residues = line . split ( ) values = [ ] while len ( line ) > 2 : line = fd . readline ( ) line = line . strip ( '\t\n' ) lvalues = line . split ( ) values . append ( lvalues ) fd . close ( ) data = { } for r in range ( 1 , len ( residues ) ) : data [ residues [ r ] ] = { } for i in range ( 1 , len ( values ) ) : for j in range ( 1 , len ( values [ i ] ) ) : pH = values [ i ] [ 0 ] res = residues [ j ] print 'data[%s][%s] = %s' % ( res , pH , values [ i ] [ j ] ) data [ residues [ j ] ] [ pH ] = values [ i ] [ j ] tabnames = self . nb . pagenames ( ) for residue in data . keys ( ) : dps = len ( data [ residue ] . keys ( ) ) self . reprint_parameters ( ) if not residue in tabnames : newtab_num = self . add_datalist ( residue , data_points = dps ) count = 0 for pH in data [ residue ] . keys ( ) : self . data [ newtab_num ] [ 0 ] [ count ] [ 'var' ] . set ( pH ) self . data [ newtab_num ] [ 1 ] [ count ] [ 'var' ] . set ( data [ residue ] [ pH ] ) count = count + 1 return
Import kinetic data from a nmr file
Import kinetic data from a nmr file
"""Import kinetic data from a nmr file""" #print values[i][0] # # Insert the data if it's not already there # #self.redraw_graph(fitting=1)
self
event