os.mkdir(dir) # # Does the PDB file exist? # if not os.path.isfile(pdb): failed.append(pdbid) continue os.system('cp %s %s' %(pdb,newpdb)) # # Correct with WI # import WI_tools renumb=1 setcha=None readallmodels=None logifile,files=WI_tools.delwat_dellig_corall(newpdb,renumb,readallmodels,setcha) filenms=files.keys() if len(filenms)!=1: print 'More than one filename',filenms failed.append(pdbid) continue import string # # Do we have a chain identifier? # chainid=-1 changes=0 for line in files[filenms[0]]: split=string.split(line) #print split if split[0]=='ATOM':
def main(): # # Run pKa calculations in all subdirs given as argument # import sys print print 'Run pKa calculations in all subdirs. ' print print 'Looking for pdb files with the name: %s' %sys.argv[1] print 'Running pKa calculations for: ' import os, sys, string initial_pdbfile='pdbfile.pdb' dirs=sys.argv[1:] # # if the last argument is '-name', then the name of the dir is part of the pdbfile name # top=os.getcwd() for dir in dirs: if os.path.isdir(dir): print dir print print '----------------------' for dir in dirs: if os.path.isdir(dir): initial_pdbfile=dir+'.pdb' pkafile=os.path.join(dir,'clean.pka.pdb') if not os.path.isfile(pkafile): import WI_tools logfile,files=WI_tools.delwat_dellig_corall(os.path.join(os.getcwd(),dir,initial_pdbfile),None,1) print os.path.join(os.getcwd(),dir,initial_pdbfile) for line in logfile: print line, fs=files.keys() print fs if len(fs)!=1: done=None print dir import string pdbfile=string.lower(dir[-4:])+'.pdb.gz' pdbdir='/net/scratch67/jnielsen/pdb' pdbfile=os.path.join(pdbdir,pdbfile) if os.path.isfile(pdbfile): print 'Could not find file' #a=raw_input('Get file from pdb dir? ') #a='y' a='n' if a=='y': destination=os.path.join(os.getcwd(),dir,os.path.split(pdbfile)[1]) print destination os.system('cp '+pdbfile+' '+destination) os.system(gunzip+' '+destination) destination=destination[:-3] print destination os.link(destination,os.path.join(os.getcwd(),dir,initial_pdbfile)) done=1 if not done: print initial_pdbfile raise 'Huh? - could not clean PDB file' else: fd=open(pkafile,'w') fd2=open(pkafile+'.backup','w') for line in files[fs[0]]: fd2.write(line) fd.write(line) fd.close() fd2.close() print 'Cleaned PDB file written' # # Prepare the pKa calculation (write the Invocation file) # import splitpdb splitpdb.prep_pKa(dir,os.path.split(pkafile)[1]) os.chdir(dir) import pKa # # Read the parameters # infile='Invocation' fd=open(infile) line=fd.readline() fd.close() argv=string.split(line) # # Do we need to run the pKa calculations for this dir? # pdbfile=argv[1] if not os.path.isfile(pdbfile+'.PKA.DAT'): print 'Running pKa calculations for: %s ' %dir print print 'Using command:',string.join(argv) # # Parse parameters # x=pKa.pKamisc() params=x.parse_parameterlist(argv) X=pKa.pKarun(os.getcwd(),pdbfile,params) X.runseq() print '=============================' print os.chdir(top) return
def main(): # # Run pKa calculations in all subdirs given as argument # import sys print print 'Run pKa calculations in all subdirs. ' print print 'Looking for pdb files with the name: %s' % sys.argv[1] print 'Running pKa calculations for: ' import os, sys, string initial_pdbfile = 'pdbfile.pdb' dirs = sys.argv[1:] # # if the last argument is '-name', then the name of the dir is part of the pdbfile name # top = os.getcwd() for dir in dirs: if os.path.isdir(dir): print dir print print '----------------------' for dir in dirs: if os.path.isdir(dir): initial_pdbfile = dir + '.pdb' pkafile = os.path.join(dir, 'clean.pka.pdb') if not os.path.isfile(pkafile): import WI_tools logfile, files = WI_tools.delwat_dellig_corall( os.path.join(os.getcwd(), dir, initial_pdbfile), None, 1) print os.path.join(os.getcwd(), dir, initial_pdbfile) for line in logfile: print line, fs = files.keys() print fs if len(fs) != 1: done = None print dir import string pdbfile = string.lower(dir[-4:]) + '.pdb.gz' pdbdir = '/net/scratch67/jnielsen/pdb' pdbfile = os.path.join(pdbdir, pdbfile) if os.path.isfile(pdbfile): print 'Could not find file' #a=raw_input('Get file from pdb dir? ') #a='y' a = 'n' if a == 'y': destination = os.path.join( os.getcwd(), dir, os.path.split(pdbfile)[1]) print destination os.system('cp ' + pdbfile + ' ' + destination) os.system(gunzip + ' ' + destination) destination = destination[:-3] print destination os.link( destination, os.path.join(os.getcwd(), dir, initial_pdbfile)) done = 1 if not done: print initial_pdbfile raise 'Huh? - could not clean PDB file' else: fd = open(pkafile, 'w') fd2 = open(pkafile + '.backup', 'w') for line in files[fs[0]]: fd2.write(line) fd.write(line) fd.close() fd2.close() print 'Cleaned PDB file written' # # Prepare the pKa calculation (write the Invocation file) # import splitpdb splitpdb.prep_pKa(dir, os.path.split(pkafile)[1]) os.chdir(dir) import pKa # # Read the parameters # infile = 'Invocation' fd = open(infile) line = fd.readline() fd.close() argv = string.split(line) # # Do we need to run the pKa calculations for this dir? # pdbfile = argv[1] if not os.path.isfile(pdbfile + '.PKA.DAT'): print 'Running pKa calculations for: %s ' % dir print print 'Using command:', string.join(argv) # # Parse parameters # x = pKa.pKamisc() params = x.parse_parameterlist(argv) X = pKa.pKarun(os.getcwd(), pdbfile, params) X.runseq() print '=============================' print os.chdir(top) return
os.mkdir(dir) # # Does the PDB file exist? # if not os.path.isfile(pdb): failed.append(pdbid) continue os.system('cp %s %s' % (pdb, newpdb)) # # Correct with WI # import WI_tools renumb = 1 setcha = None readallmodels = None logifile, files = WI_tools.delwat_dellig_corall(newpdb, renumb, readallmodels, setcha) filenms = files.keys() if len(filenms) != 1: print 'More than one filename', filenms failed.append(pdbid) continue import string # # Do we have a chain identifier? # chainid = -1 changes = 0 for line in files[filenms[0]]: split = string.split(line) #print split if split[0] == 'ATOM':