PEATDB/Ekin/IO.py
def copy_peak(self,event=None):
        """Copy the selected peak to the data"""
        selection=self.peaks_read.curselection()
        residues=[]
        data={}
        f = self.fval.get()
        for sel_number in selection:
            residue=self.peak_residues[int(sel_number)]
            #
            # Construct the titration curve
            #
            data[residue]={}
            pHs=self.peaks.keys()
            pHs.sort()
            for pH in pHs:
                if self.peaks[pH].has_key(residue):
                    data[residue][pH]=self.peaks[pH][residue]

            #print data[residue]
            # Get combined shift if user chose 'both'
            if self.assigncol == 'both':
                import sparky
                Hlist=[]
                Nlist=[]
                for pH in data[residue].keys(): #create lists for H and N
                    Hlist.append(data[residue][pH]['H'])
                    Nlist.append(data[residue][pH]['N'])
                href=min(Hlist)
                nref=min(Nlist)
                for pH in data[residue].keys():
                    h=data[residue][pH]['H']
                    n=data[residue][pH]['N']
                    data[residue][pH]['both']=sparky.calc_delta_shift(h, n, href, nref ,f)

            #print data[residue]
        
        # Delete all the other tabs first if needed        
        if self.removecurrent.get()==1:
            self.parent.deleteAll()

        
        # Insert the data if it's not already there, but ask to overwrite if it is!        
        datasets = {}
        for peak in data.keys():
            num_vars=2
            x=[]
            y=[]
            count=0
            for pH in data[peak].keys():
                x.append(pH)
                y.append(data[peak][pH][self.assigncol])
                count=count+1            
           
	    datasets[peak]=EkinDataset(xy=[x,y])

        #add to ekin from here - easier for now...
	self.parent.insertMultipleDatasets(datasets, overwrite=self.overwrite_all.get())    
        self.parent.mode_var.set(4)
        return
Copy the selected peak to the data
Copy the selected peak to the data
Copy the selected peak to the data
def copy_peak(self,event=None):
        selection=self.peaks_read.curselection()
        residues=[]
        data={}
        f = self.fval.get()
        for sel_number in selection:
            residue=self.peak_residues[int(sel_number)]
             Construct the titration curve
            data[residue]={}
            pHs=self.peaks.keys()
            pHs.sort()
            for pH in pHs:
                if self.peaks[pH].has_key(residue):
                    data[residue][pH]=self.peaks[pH][residue]
            print data[residue]
             Get combined shift if user chose 'both'
            if self.assigncol == 'both':
                import sparky
                Hlist=[]
                Nlist=[]
                for pH in data[residue].keys(): create lists for H and N
                    Hlist.append(data[residue][pH]['H'])
                    Nlist.append(data[residue][pH]['N'])
                href=min(Hlist)
                nref=min(Nlist)
                for pH in data[residue].keys():
                    h=data[residue][pH]['H']
                    n=data[residue][pH]['N']
                    data[residue][pH]['both']=sparky.calc_delta_shift(h, n, href, nref ,f)
            print data[residue]
         Delete all the other tabs first if needed        
        if self.removecurrent.get()==1:
            self.parent.deleteAll()
         Insert the data if it's not already there, but ask to overwrite if it is!        
        datasets = {}
        for peak in data.keys():
            num_vars=2
            x=[]
            y=[]
            count=0
            for pH in data[peak].keys():
                x.append(pH)
                y.append(data[peak][pH][self.assigncol])
                count=count+1            
	    datasets[peak]=EkinDataset(xy=[x,y])
        add to ekin from here - easier for now...
	self.parent.insertMultipleDatasets(datasets, overwrite=self.overwrite_all.get())    
        self.parent.mode_var.set(4)
        return
def copy_peak ( self , event = None ) : selection = self . peaks_read . curselection ( ) residues = [ ] data = { } f = self . fval . get ( ) for sel_number in selection : residue = self . peak_residues [ int ( sel_number ) ] data [ residue ] = { } pHs = self . peaks . keys ( ) pHs . sort ( ) for pH in pHs : if self . peaks [ pH ] . has_key ( residue ) : data [ residue ] [ pH ] = self . peaks [ pH ] [ residue ] if self . assigncol == 'both' : import sparky Hlist = [ ] Nlist = [ ] for pH in data [ residue ] . keys ( ) : Hlist . append ( data [ residue ] [ pH ] [ 'H' ] ) Nlist . append ( data [ residue ] [ pH ] [ 'N' ] ) href = min ( Hlist ) nref = min ( Nlist ) for pH in data [ residue ] . keys ( ) : h = data [ residue ] [ pH ] [ 'H' ] n = data [ residue ] [ pH ] [ 'N' ] data [ residue ] [ pH ] [ 'both' ] = sparky . calc_delta_shift ( h , n , href , nref , f ) if self . removecurrent . get ( ) == 1 : self . parent . deleteAll ( ) datasets = { } for peak in data . keys ( ) : num_vars = 2 x = [ ] y = [ ] count = 0 for pH in data [ peak ] . keys ( ) : x . append ( pH ) y . append ( data [ peak ] [ pH ] [ self . assigncol ] ) count = count + 1 datasets [ peak ] = EkinDataset ( xy = [ x , y ] ) self . parent . insertMultipleDatasets ( datasets , overwrite = self . overwrite_all . get ( ) ) self . parent . mode_var . set ( 4 ) return
Copy the selected peak to the data
Copy the selected peak to the data
"""Copy the selected peak to the data""" # # Construct the titration curve # #print data[residue] # Get combined shift if user chose 'both' #create lists for H and N #print data[residue] # Delete all the other tabs first if needed         # Insert the data if it's not already there, but ask to overwrite if it is!         #add to ekin from here - easier for now...
self
event