Ghost/calc_dCS.py
def main(options,args):
    """Calculate the change in chemical shift due to a full charge on each titratable group"""
    import get_dEF
    method=options.method 
    X=get_dEF.map_struct(args[0])
    X.build_Hs()
    residues=X.PI.residues.keys()
    residues.sort()
    #
    # Get the titratable groups
    #
    titgroups=X.PI.get_titratable_groups()
    titgroups.sort()
    import pKa.pKD_tools
    if options.group_by_titgroup:
        for titgroup in titgroups:
            titgroup_type=pKa.pKD_tools.get_titgroup_type_from_titgroup(titgroup)
            charge=X.PI.titgroups[titgroup_type]['charge']
            print 'TITRATABLE GROUP',titgroup
            print 'Residue  CS Nitrogen    CS Hydrogen'
            
            for residue in residues:
                dCS_N=X.get_dCS(residue+':N',titgroup,charge=charge,method=method)
                dCS_H=X.get_dCS(residue+':H',titgroup,charge=charge,method=method)
                print '%8s,    %s,    %s' %(residue,Nonefix(dCS_N),Nonefix(dCS_H))
    else:
        #
        # Group by atom
        #
        for residue in residues:
            for atom in [':N',':H']:
                changes=[]
                for titgroup in titgroups:
                    titgroup_type=pKa.pKD_tools.get_titgroup_type_from_titgroup(titgroup)
                    charge=X.PI.titgroups[titgroup_type]['charge']
                    dCS=X.get_dCS(residue+atom,titgroup,charge=charge,method=method)
                    changes.append([titgroup,dCS])
                #
                if options.sort:
                    def cmpfunc(x,y):
                        if x[1] is None:
                            return 1
                        if y[1] is None:
                            return -1
                        return cmp(abs(y[1]),abs(x[1]))
                    changes.sort(cmpfunc)
                print 'Residue: %s, Atom: %s' %(residue,atom[1])
                for titgroup,dCS in changes[:options.listnumber]:
                    if dCS:
                        if abs(dCS)<options.limit:
                            continue
                        print titgroup,dCS
                print
    return
Calculate the change in chemical shift due to a full charge on each titratable group
Calculate the change in chemical shift due to a full charge on each titratable group
Calculate the change in chemical shift due to a full charge on each titratable group
def main(options,args):
    import get_dEF
    method=options.method 
    X=get_dEF.map_struct(args[0])
    X.build_Hs()
    residues=X.PI.residues.keys()
    residues.sort()
     Get the titratable groups
    titgroups=X.PI.get_titratable_groups()
    titgroups.sort()
    import pKa.pKD_tools
    if options.group_by_titgroup:
        for titgroup in titgroups:
            titgroup_type=pKa.pKD_tools.get_titgroup_type_from_titgroup(titgroup)
            charge=X.PI.titgroups[titgroup_type]['charge']
            print 'TITRATABLE GROUP',titgroup
            print 'Residue  CS Nitrogen    CS Hydrogen'
            for residue in residues:
                dCS_N=X.get_dCS(residue+':N',titgroup,charge=charge,method=method)
                dCS_H=X.get_dCS(residue+':H',titgroup,charge=charge,method=method)
                print '%8s,    %s,    %s' %(residue,Nonefix(dCS_N),Nonefix(dCS_H))
    else:
         Group by atom
        for residue in residues:
            for atom in [':N',':H']:
                changes=[]
                for titgroup in titgroups:
                    titgroup_type=pKa.pKD_tools.get_titgroup_type_from_titgroup(titgroup)
                    charge=X.PI.titgroups[titgroup_type]['charge']
                    dCS=X.get_dCS(residue+atom,titgroup,charge=charge,method=method)
                    changes.append([titgroup,dCS])
                if options.sort:
                    def cmpfunc(x,y):
                        if x[1] is None:
                            return 1
                        if y[1] is None:
                            return -1
                        return cmp(abs(y[1]),abs(x[1]))
                    changes.sort(cmpfunc)
                print 'Residue: %s, Atom: %s' %(residue,atom[1])
                for titgroup,dCS in changes[:options.listnumber]:
                    if dCS:
                        if abs(dCS)<options.limit:
                            continue
                        print titgroup,dCS
                print
    return
def main ( options , args ) : import get_dEF method = options . method X = get_dEF . map_struct ( args [ 0 ] ) X . build_Hs ( ) residues = X . PI . residues . keys ( ) residues . sort ( ) titgroups = X . PI . get_titratable_groups ( ) titgroups . sort ( ) import pKa . pKD_tools if options . group_by_titgroup : for titgroup in titgroups : titgroup_type = pKa . pKD_tools . get_titgroup_type_from_titgroup ( titgroup ) charge = X . PI . titgroups [ titgroup_type ] [ 'charge' ] print 'TITRATABLE GROUP' , titgroup print 'Residue  CS Nitrogen    CS Hydrogen' for residue in residues : dCS_N = X . get_dCS ( residue + ':N' , titgroup , charge = charge , method = method ) dCS_H = X . get_dCS ( residue + ':H' , titgroup , charge = charge , method = method ) print '%8s,    %s,    %s' % ( residue , Nonefix ( dCS_N ) , Nonefix ( dCS_H ) ) else : for residue in residues : for atom in [ ':N' , ':H' ] : changes = [ ] for titgroup in titgroups : titgroup_type = pKa . pKD_tools . get_titgroup_type_from_titgroup ( titgroup ) charge = X . PI . titgroups [ titgroup_type ] [ 'charge' ] dCS = X . get_dCS ( residue + atom , titgroup , charge = charge , method = method ) changes . append ( [ titgroup , dCS ] ) if options . sort : def cmpfunc ( x , y ) : if x [ 1 ] is None : return 1 if y [ 1 ] is None : return - 1 return cmp ( abs ( y [ 1 ] ) , abs ( x [ 1 ] ) ) changes . sort ( cmpfunc ) print 'Residue: %s, Atom: %s' % ( residue , atom [ 1 ] ) for titgroup , dCS in changes [ : options . listnumber ] : if dCS : if abs ( dCS ) < options . limit : continue print titgroup , dCS print return
Calculate the change in chemical shift due to a full charge on each titratable group
Calculate the change in chemical shift due to a full charge on each titratable group
"""Calculate the change in chemical shift due to a full charge on each titratable group""" # # Get the titratable groups # # # Group by atom # #
options
args