pKa/prepare_for_pKa_design.py
def do_pKa_calc(pdbfile):
    """Perform a pKa calculation on the PDB file"""
    #
    # Get the name of the PDB file
    #
    import os
    pdb_name=os.path.split(pdbfile)[1]
    pdb_dir=os.path.split(pdbfile)[0]
    topdir=os.getcwd()
    #
    # Prepare the PDB file
    #
    import pKarun.WI_tools
    logfile,files=pKarun.WI_tools.dellig_delhyd_corall(pdbfile=pdbfile,readall=None,setcha=None)
    #
    # Overwrite the file
    #
    for line in logfile:
        print line,
    print
    print files.keys()
    if len(files.keys())==0:
        #
        # Write failed file
        #
        fd=open(os.path.join(pdb_dir,'failed'),'w')
        return None
    lines=files[files.keys()[0]]
    
    fd=open(pdbfile,'w')
    for line in lines:
        fd.write(line)
    fd.close()
    #
    # copy the PDB file and the parameter files
    #
    import os
    source=resources
    files=['DELRAD.DAT','DELCRG.DAT','TOPOLOGY.H']
    for file in files:
        r_s=os.path.join(source,file)
        r_d=os.path.join(pdb_dir,file)
        if not os.path.isfile(r_d):
            os.link(r_s,r_d)
    os.system('chmod -R ugo+rwx %s' %pdb_dir)
    #
    # Start pKa calc
    #
    import pKarun.pKarun_base
    params={'dbcrit':1000,'lowph':0.1,'highph':20.0,'phstep':0.1,'pairene':1.0}
    #
    # Save a record of how the pKa calc was done
    #
    fdx=open(os.path.join(pdb_dir,'Invocation_dict'),'w')
    import pickle
    pickle.dump(params,fdx)
    fdx.close()
    #
    # Run the pKa calculation
    #
    print 'Starting to run the pKa calculation'
    import sys
    sys.stdout.flush()
    Y=pKarun.pKarun_base.pKarun(os.getcwd(),pdbfile,params)
    Y.runseq()
    #
    # Check if all went well
    #
    import pKaTool.pKaIO
    X=pKaTool.pKaIO.pKaIO(pdbfile)
    calculation_success=1
    if not X.calculation_completed:
        print 'Calculation failed in ',pdbdir
        calculation_success=None
    #
    # Write a flag file to alert the scheduler
    #
    if calculation_success:
        print 'Writing Ready file'
        fd=open(os.path.join(pdb_dir,'pKacalc_done'),'w')
    else:
        #
        # Calculation failed
        #
        send_email('Jens.Nielsen@ucd.ie','pKa calculation failed for '+pdb_dir)
        print 'Writing failed file'
        fd=open(os.path.join(pdb_dir,'failed'),'w')
    #
    # Write the file
    #
    fd.write('pKa calculations\n')
    fd.close()
    #
    # Running file
    #
    runningfile=os.path.join(pdb_dir,'running')
    if os.path.isfile(runningfile):
        os.unlink(runningfile)
        print 'Deleted runningfile',runningfile
    #
    # done
    #
    print 'Everything is done'
    return 1
Perform a pKa calculation on the PDB file
Perform a pKa calculation on the PDB file
Perform a pKa calculation on the PDB file
def do_pKa_calc(pdbfile):
     Get the name of the PDB file
    import os
    pdb_name=os.path.split(pdbfile)[1]
    pdb_dir=os.path.split(pdbfile)[0]
    topdir=os.getcwd()
     Prepare the PDB file
    import pKarun.WI_tools
    logfile,files=pKarun.WI_tools.dellig_delhyd_corall(pdbfile=pdbfile,readall=None,setcha=None)
     Overwrite the file
    for line in logfile:
        print line,
    print
    print files.keys()
    if len(files.keys())==0:
         Write failed file
        fd=open(os.path.join(pdb_dir,'failed'),'w')
        return None
    lines=files[files.keys()[0]]
    fd=open(pdbfile,'w')
    for line in lines:
        fd.write(line)
    fd.close()
     copy the PDB file and the parameter files
    import os
    source=resources
    files=['DELRAD.DAT','DELCRG.DAT','TOPOLOGY.H']
    for file in files:
        r_s=os.path.join(source,file)
        r_d=os.path.join(pdb_dir,file)
        if not os.path.isfile(r_d):
            os.link(r_s,r_d)
    os.system('chmod -R ugo+rwx %s' %pdb_dir)
     Start pKa calc
    import pKarun.pKarun_base
    params={'dbcrit':1000,'lowph':0.1,'highph':20.0,'phstep':0.1,'pairene':1.0}
     Save a record of how the pKa calc was done
    fdx=open(os.path.join(pdb_dir,'Invocation_dict'),'w')
    import pickle
    pickle.dump(params,fdx)
    fdx.close()
     Run the pKa calculation
    print 'Starting to run the pKa calculation'
    import sys
    sys.stdout.flush()
    Y=pKarun.pKarun_base.pKarun(os.getcwd(),pdbfile,params)
    Y.runseq()
     Check if all went well
    import pKaTool.pKaIO
    X=pKaTool.pKaIO.pKaIO(pdbfile)
    calculation_success=1
    if not X.calculation_completed:
        print 'Calculation failed in ',pdbdir
        calculation_success=None
     Write a flag file to alert the scheduler
    if calculation_success:
        print 'Writing Ready file'
        fd=open(os.path.join(pdb_dir,'pKacalc_done'),'w')
    else:
         Calculation failed
        send_email('Jens.Nielsen@ucd.ie','pKa calculation failed for '+pdb_dir)
        print 'Writing failed file'
        fd=open(os.path.join(pdb_dir,'failed'),'w')
     Write the file
    fd.write('pKa calculations\n')
    fd.close()
     Running file
    runningfile=os.path.join(pdb_dir,'running')
    if os.path.isfile(runningfile):
        os.unlink(runningfile)
        print 'Deleted runningfile',runningfile
     done
    print 'Everything is done'
    return 1
def do_pKa_calc ( pdbfile ) : import os pdb_name = os . path . split ( pdbfile ) [ 1 ] pdb_dir = os . path . split ( pdbfile ) [ 0 ] topdir = os . getcwd ( ) import pKarun . WI_tools logfile , files = pKarun . WI_tools . dellig_delhyd_corall ( pdbfile = pdbfile , readall = None , setcha = None ) for line in logfile : print line , print print files . keys ( ) if len ( files . keys ( ) ) == 0 : fd = open ( os . path . join ( pdb_dir , 'failed' ) , 'w' ) return None lines = files [ files . keys ( ) [ 0 ] ] fd = open ( pdbfile , 'w' ) for line in lines : fd . write ( line ) fd . close ( ) import os source = resources files = [ 'DELRAD.DAT' , 'DELCRG.DAT' , 'TOPOLOGY.H' ] for file in files : r_s = os . path . join ( source , file ) r_d = os . path . join ( pdb_dir , file ) if not os . path . isfile ( r_d ) : os . link ( r_s , r_d ) os . system ( 'chmod -R ugo+rwx %s' % pdb_dir ) import pKarun . pKarun_base params = { 'dbcrit' : 1000 , 'lowph' : 0.1 , 'highph' : 20.0 , 'phstep' : 0.1 , 'pairene' : 1.0 } fdx = open ( os . path . join ( pdb_dir , 'Invocation_dict' ) , 'w' ) import pickle pickle . dump ( params , fdx ) fdx . close ( ) print 'Starting to run the pKa calculation' import sys sys . stdout . flush ( ) Y = pKarun . pKarun_base . pKarun ( os . getcwd ( ) , pdbfile , params ) Y . runseq ( ) import pKaTool . pKaIO X = pKaTool . pKaIO . pKaIO ( pdbfile ) calculation_success = 1 if not X . calculation_completed : print 'Calculation failed in ' , pdbdir calculation_success = None if calculation_success : print 'Writing Ready file' fd = open ( os . path . join ( pdb_dir , 'pKacalc_done' ) , 'w' ) else : send_email ( 'Jens.Nielsen@ucd.ie' , 'pKa calculation failed for ' + pdb_dir ) print 'Writing failed file' fd = open ( os . path . join ( pdb_dir , 'failed' ) , 'w' ) fd . write ( 'pKa calculations\n' ) fd . close ( ) runningfile = os . path . join ( pdb_dir , 'running' ) if os . path . isfile ( runningfile ) : os . unlink ( runningfile ) print 'Deleted runningfile' , runningfile print 'Everything is done' return 1
Perform a pKa calculation on the PDB file
Perform a pKa calculation on the PDB file
"""Perform a pKa calculation on the PDB file""" # # Get the name of the PDB file # # # Prepare the PDB file # # # Overwrite the file # # # Write failed file # # # copy the PDB file and the parameter files # # # Start pKa calc # # # Save a record of how the pKa calc was done # # # Run the pKa calculation # # # Check if all went well # # # Write a flag file to alert the scheduler # # # Calculation failed # # # Write the file # # # Running file # # # done #
pdbfile