pKa/pKa_alascan.py
def main():
    """Load the PDB file, make all Ala mutations and calculate dpKa for the target residues"""
    try:
        import sys
        pdbfile=sys.argv[1]
        target_residues=sys.argv[2]
    except:
        print
        print 'Usage: pKa_alascan.py <pdbfile> <target residues>'
        print 'Example: pKa_alascan.py 2lzt.pdb :0035:GLU,:0052:ASP'
        print 'This command will perform a full Alanine scan and report the effect of each mutation on the pKa values of Glu 35 and Asp 52'
        print 'If ALL is supplied instead of a list of target residues, then dpKas will be calculated for all residues'
        print
        raise Exception,'Incorrect usage'
    #
    # Start the work
    #
    import Protool
    P=Protool.structureIO()
    P.readpdb(pdbfile)
    residues=P.residues.keys()
    residues.sort()
    #
    # All titgroups?
    #
    if target_residues=='ALL':
        titgroups=P.get_titratable_groups()
        import string
        target_residues=string.join(titgroups,',')
    #
    # Start looping
    #
    results={}
    import pickle, os
    for residue in residues:
        #
        # Define result filename
        #
        resultfile=os.path.join(os.getcwd(),'alascan_%s.result' %residue)
        if os.path.isfile(resultfile):
            fd=open(resultfile)
            results[residue]=pickle.load(fd)
            fd.close()
        else:
            if P.resname(residue)=='ALA' or P.resname(residue)=='GLY' or not P.isaa(residue):
                print 'Skipping',residue,P.resname(residue)
                continue
            print 'Calculating for residue',residue,P.resname(residue)
            recalc_intpka=1
            defaults=local_defaults(pdbfile,target_residues,recalc_intpka)
            #
            # Set the mutations
            #
            defaults['mutations'][0]='%s:%s:%s' %(residue,P.resname(residue),'ALA')
            import pKa.Design_pKa as Design_pKa
            #
            # Calculate the dpKas
            #
            solutions,pKd_dict=Design_pKa.run_opt(defaults)
            results[residue]=solutions.copy()
            #
            # Save this result
            #
            fd=open(resultfile,'w')
            pickle.dump(results[residue],fd)
            fd.close()
    #
    # Save all
    #
    name='%s.alascan.pickle' %pdbfile
    fd=open(name,'w')
    import pickle
    pickle.dump(results,fd)
    fd.close()
Load the PDB file, make all Ala mutations and calculate dpKa for the target residues
Load the PDB file, make all Ala mutations and calculate dpKa for the target residues
Load the PDB file make all Ala mutations and calculate dpKa for the target residues
def main():
    try:
        import sys
        pdbfile=sys.argv[1]
        target_residues=sys.argv[2]
    except:
        print
        print 'Usage: pKa_alascan.py <pdbfile> <target residues>'
        print 'Example: pKa_alascan.py 2lzt.pdb :0035:GLU,:0052:ASP'
        print 'This command will perform a full Alanine scan and report the effect of each mutation on the pKa values of Glu 35 and Asp 52'
        print 'If ALL is supplied instead of a list of target residues, then dpKas will be calculated for all residues'
        print
        raise Exception,'Incorrect usage'
     Start the work
    import Protool
    P=Protool.structureIO()
    P.readpdb(pdbfile)
    residues=P.residues.keys()
    residues.sort()
     All titgroups?
    if target_residues=='ALL':
        titgroups=P.get_titratable_groups()
        import string
        target_residues=string.join(titgroups,',')
     Start looping
    results={}
    import pickle, os
    for residue in residues:
         Define result filename
        resultfile=os.path.join(os.getcwd(),'alascan_%s.result' %residue)
        if os.path.isfile(resultfile):
            fd=open(resultfile)
            results[residue]=pickle.load(fd)
            fd.close()
        else:
            if P.resname(residue)=='ALA' or P.resname(residue)=='GLY' or not P.isaa(residue):
                print 'Skipping',residue,P.resname(residue)
                continue
            print 'Calculating for residue',residue,P.resname(residue)
            recalc_intpka=1
            defaults=local_defaults(pdbfile,target_residues,recalc_intpka)
             Set the mutations
            defaults['mutations'][0]='%s:%s:%s' %(residue,P.resname(residue),'ALA')
            import pKa.Design_pKa as Design_pKa
             Calculate the dpKas
            solutions,pKd_dict=Design_pKa.run_opt(defaults)
            results[residue]=solutions.copy()
             Save this result
            fd=open(resultfile,'w')
            pickle.dump(results[residue],fd)
            fd.close()
     Save all
    name='%s.alascan.pickle' %pdbfile
    fd=open(name,'w')
    import pickle
    pickle.dump(results,fd)
    fd.close()
def main ( ) : try : import sys pdbfile = sys . argv [ 1 ] target_residues = sys . argv [ 2 ] except : print print 'Usage: pKa_alascan.py <pdbfile> <target residues>' print 'Example: pKa_alascan.py 2lzt.pdb :0035:GLU,:0052:ASP' print 'This command will perform a full Alanine scan and report the effect of each mutation on the pKa values of Glu 35 and Asp 52' print 'If ALL is supplied instead of a list of target residues, then dpKas will be calculated for all residues' print raise Exception , 'Incorrect usage' import Protool P = Protool . structureIO ( ) P . readpdb ( pdbfile ) residues = P . residues . keys ( ) residues . sort ( ) if target_residues == 'ALL' : titgroups = P . get_titratable_groups ( ) import string target_residues = string . join ( titgroups , ',' ) results = { } import pickle , os for residue in residues : resultfile = os . path . join ( os . getcwd ( ) , 'alascan_%s.result' % residue ) if os . path . isfile ( resultfile ) : fd = open ( resultfile ) results [ residue ] = pickle . load ( fd ) fd . close ( ) else : if P . resname ( residue ) == 'ALA' or P . resname ( residue ) == 'GLY' or not P . isaa ( residue ) : print 'Skipping' , residue , P . resname ( residue ) continue print 'Calculating for residue' , residue , P . resname ( residue ) recalc_intpka = 1 defaults = local_defaults ( pdbfile , target_residues , recalc_intpka ) defaults [ 'mutations' ] [ 0 ] = '%s:%s:%s' % ( residue , P . resname ( residue ) , 'ALA' ) import pKa . Design_pKa as Design_pKa solutions , pKd_dict = Design_pKa . run_opt ( defaults ) results [ residue ] = solutions . copy ( ) fd = open ( resultfile , 'w' ) pickle . dump ( results [ residue ] , fd ) fd . close ( ) name = '%s.alascan.pickle' % pdbfile fd = open ( name , 'w' ) import pickle pickle . dump ( results , fd ) fd . close ( )
Load the PDB file, make all Ala mutations and calculate dpKa for the target residues
Load the PDB file make all Ala mutations and calculate dpKa for the target residues
"""Load the PDB file, make all Ala mutations and calculate dpKa for the target residues""" # # Start the work # # # All titgroups? # # # Start looping # # # Define result filename # # # Set the mutations # # # Calculate the dpKas # # # Save this result # # # Save all #