__author__ = 'fanzheng' import os, argparse, sys import subprocess, threading import General selfbin = os.path.dirname(os.path.realpath(sys.argv[0])) ldir1 = General.createLocalSpace() ldir2 = General.createLocalSpace() # data files are here cmd_setup = ['perl -w', selfbin +'/mdNAMD.pl', '-p', 'dummy.pdb', '-n', '1000000', '--ns', '1000', '--ts', '2', '--pad', '9', '--Pext', '1.01325', '--mini', '5000', '--top', '/home/grigoryanlab/home/fzheng/PDZ.2014/MD/Dcmap/top_all22_prot_namd.inp', '--par', '/home/grigoryanlab/home/fzheng/PDZ.2014/MD/Dcmap/par_all22_prot.inp', '--psfopts', '"first nter; last cter|first ace; last ct3"', '--np', '6', '--pme', '--odir', ldir2, '--dry', '--tmp', ldir1] cmd_setup = ' '.join(cmd_setup) par = argparse.ArgumentParser() par.add_argument('--p', required = True, help = 'input pdb') par.add_argument('--v', action = 'store_true', help = 'if true, copy everything back from local directory') par.add_argument('--change', nargs ='+', help = 'if want to change the settings in setup command, provide strings in pairs, before and after change respectively; \n Original command: ' + cmd_setup ) par.add_argument('--nc', default = 4, type = int, help = 'the number of cores to use') par.add_argument('--hrs', default = 23, type = float, help = 'time allocated to run this job, in hours') args = par.parse_args() cmd_setup = cmd_setup.replace('dummy.pdb', args.p) if args.change != None: assert len(args.change) % 2 == 0 for i in range(0, len(args.change), 2): cmd_setup.replace(args.change[i], args.change[i+1]) cmd_run = ['/home/grigoryanlab/library/bin/charmrun', '+p'+str(args.nc), '/home/grigoryanlab/library/bin/namd2', 'namdrun_run.ctl >& namdrun_run.out'] cmd_run = ' '.join(cmd_run) odir = os.getcwd()
pepseq = args.pseq pdz.normalMut('_start.pdb', range(pepstart, pepend+1), pepseq, 'start.pdb') # clean up os.system('rm -r _*') os.chdir(odir) # the fpd part pepfrags = '/home/grigoryanlab/home/fzheng/PDZ.2014/pepfrags/' fpddemo = '/home/grigoryanlab/home/fzheng/PDZ.2014/FlexPepDock_AbInitio/' flag = fpddemo + 'input_files/flags' pflag = fpddemo + 'input_files/prepack_flags' rosetta_db = '/home/grigoryanlab/home/fzheng/rosetta2014/main/database' rosetta_exe = '/home/grigoryanlab/home/fzheng/rosetta2014/main/source/bin' ldir = General.createLocalSpace() os.system('cp '+ mdir + '/start.pdb ' + ldir + '/start.pdb') os.system('cp '+ mdir + '/start.pdb ' + ldir + '/native.pdb') os.chdir(ldir) if args.ab != 0: # not tested, now only work for natural aa # make fragments fragf = '/'.join([odir, args.pname, '.fragready']) if args.ab == 2: while os.path.isfile(fragf) == False: sleep(10) else: os.system(fpddemo + 'scripts/prep_abinitio.sh 0000') os.system('cp -dr frags '+pepfrags+args.pname) os.system('touch '+fragf) # copy stuff
cmd_confind = [CONFIND, '--p', pdbf, '--o', cmap_file, '--rLib', ROTLIB] sub.call(cmd_confind) else: print 'Skip running Confind...' # if using environment adjustment, need to have self contact degree and crowdness if args.env: env_file = changeExt(pdbf, 'env.db') print 'Calculate environment for the query protein...' envToShelve(cmap_file, env_file) residues_env = shelve.open(env_file, 'r') head = ['r1', 'ur1', 'r2', 'ur2'] # set up and create working directory paths ldir = General.createLocalSpace('collin') FRAGMENTS_OUT = ldir + '/' + base + '/fragments' DESIGNSCORE_OUT = ldir + '/' + base + '/designscore' ABUNDANCE_OUT = ldir + '/' + base + '/abundance' for out in [FRAGMENTS_OUT, DESIGNSCORE_OUT, ABUNDANCE_OUT]: if not os.path.isdir(out): os.makedirs(out) # read in PDB file protein = parsePDB(pdbf).select('protein').copy() residues = [] for res in protein.iterResidues(): residues.append(res) resInTerm = {} # what residues are contained by the term of a residue? # functions