pKaTool/pKa_system_file_menu.py
def save_curves(self):
        """Save titration curves in a file"""
        import tkFileDialog, os
        savedir=os.getcwd()
        filename=tkFileDialog.asksaveasfilename(defaultextension='.tcrv',
                                                initialdir=savedir,
                                                filetypes=[("pKaTool titration curve file","*.tcrv"),("All files","*.*")])
        if filename:
                #
                # If the file is already there then delete it
                #
                if os.path.isfile(filename):
                    os.unlink(filename)
                #
                # Write everything nicely
                #
                fd=open(filename,'w')
                groups=self.titration_curves.keys()
                groups.sort()
                pHs=self.titration_curves[groups[0]].keys()
                pHs.sort()
                text='pH\t'
                for group in groups:
                    text=text+'%s\t' %group
                fd.write(text+'\n')
                for pH in pHs:
                    if pH=='pKa':
                        continue
                    text='%5.2f\t' %pH
                    for group in groups:
                        text=text+'%9.2f\t' %self.titration_curves[group][pH]
                    fd.write(text+'\n')
                fd.write('END\n')
                fd.close()
        return
Save titration curves in a file
Save titration curves in a file
Save titration curves in a file
def save_curves(self):
        import tkFileDialog, os
        savedir=os.getcwd()
        filename=tkFileDialog.asksaveasfilename(defaultextension='.tcrv',
                                                initialdir=savedir,
                                                filetypes=[("pKaTool titration curve file","*.tcrv"),("All files","*.*")])
        if filename:
                 If the file is already there then delete it
                if os.path.isfile(filename):
                    os.unlink(filename)
                 Write everything nicely
                fd=open(filename,'w')
                groups=self.titration_curves.keys()
                groups.sort()
                pHs=self.titration_curves[groups[0]].keys()
                pHs.sort()
                text='pH\t'
                for group in groups:
                    text=text+'%s\t' %group
                fd.write(text+'\n')
                for pH in pHs:
                    if pH=='pKa':
                        continue
                    text='%5.2f\t' %pH
                    for group in groups:
                        text=text+'%9.2f\t' %self.titration_curves[group][pH]
                    fd.write(text+'\n')
                fd.write('END\n')
                fd.close()
        return
def save_curves ( self ) : import tkFileDialog , os savedir = os . getcwd ( ) filename = tkFileDialog . asksaveasfilename ( defaultextension = '.tcrv' , initialdir = savedir , filetypes = [ ( "pKaTool titration curve file" , "*.tcrv" ) , ( "All files" , "*.*" ) ] ) if filename : if os . path . isfile ( filename ) : os . unlink ( filename ) fd = open ( filename , 'w' ) groups = self . titration_curves . keys ( ) groups . sort ( ) pHs = self . titration_curves [ groups [ 0 ] ] . keys ( ) pHs . sort ( ) text = 'pH\t' for group in groups : text = text + '%s\t' % group fd . write ( text + '\n' ) for pH in pHs : if pH == 'pKa' : continue text = '%5.2f\t' % pH for group in groups : text = text + '%9.2f\t' % self . titration_curves [ group ] [ pH ] fd . write ( text + '\n' ) fd . write ( 'END\n' ) fd . close ( ) return
Save titration curves in a file
Save titration curves in a file
"""Save titration curves in a file""" # # If the file is already there then delete it # # # Write everything nicely #
self