def main(): for code in PDBLIST: with temp_change_dir(code): try: pdbfiles = glob(PDB_PATTERN) for pdbfile in pdbfiles: parm = pmd.load_file(pdbfile) pdbfile_root = pdbfile.replace('.pdb', '') fn = 'NoH_' + pdbfile new_parm = parm[[index for index, atom in enumerate( parm.atoms) if atom.atomic_number != 1]] new_parm.save(fn, overwrite=True) run_tleap(code, pdbfile_root, tleap_template) except TypeError: print('type error: ', code) except IndexError: print('index error: ', code)
quit ''' pdb_pattern = 'empty*.pdb' def run_tleap(code, pdbfile_root, tleap_template): leap_fn = 'tleap.{}.in'.format(pdbfile_root) with open(leap_fn, 'w') as fh: cm = tleap_template.format(pdbfile_root=pdbfile_root) fh.write(cm) os.system('tleap -f {}'.format(leap_fn)) os.remove(leap_fn) os.remove('log.{}'.format(pdbfile_root)) for code in PDBLIST: with temp_change_dir(code): try: # os.system('rm *.parm7') # os.system('cp {} ./{}.parm7'.format(parmfile, code)) # parmfile = glob('*.parm7')[0] # os.system('cp {parmfile} {code}.parm7'.format(parmfile=parmfile, code=code)) pdbfiles = glob(pdb_pattern) my_pdbfiles = get_commands_for_my_rank(pdbfiles, rank=rank) for pdbfile in my_pdbfiles: parm = pmd.load_file(pdbfile) pdbfile_root = pdbfile.replace('.pdb', '') fn = 'NoH_' + pdbfile new_parm = parm[[index for index, atom in enumerate(parm.atoms) if atom.atomic_number != 1]] new_parm.save(fn, overwrite=True) run_tleap(code, pdbfile_root, tleap_template) except TypeError:
from glob import iglob, glob from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.rank sys.path.append( '/project1/dacase-001/haichit/rosseta_amber/DecoyDiscrimination/scripts/elf1/' ) from submit_elf1 import temp_change_dir from run_min import get_total_commands, get_commands_for_my_rank, run_each_core script = "/project1/dacase-001/haichit/rosseta_amber/DecoyDiscrimination/scripts/elf1/move_unqualified_rst7_files.py" for fn in get_commands_for_my_rank(glob('./*'), rank): if not os.path.isfile(fn): # folder try: with temp_change_dir(fn): print(fn) os.system('python {}'.format(script)) no_restraint_fn = fn + '/no_restraint/' if os.path.exists(no_restraint_fn): with temp_change_dir(no_restraint_fn): print(no_restraint_fn) os.system('python {}'.format(script)) except IndexError: pass
import os, sys from glob import iglob, glob from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.rank sys.path.append('/project1/dacase-001/haichit/rosseta_amber/DecoyDiscrimination/scripts/elf1/') from submit_elf1 import temp_change_dir from run_min import get_total_commands, get_commands_for_my_rank, run_each_core script = "/project1/dacase-001/haichit/rosseta_amber/DecoyDiscrimination/scripts/elf1/move_unqualified_rst7_files.py" for fn in get_commands_for_my_rank(glob('./*'), rank): if not os.path.isfile(fn): # folder try: with temp_change_dir(fn): print(fn) os.system('python {}'.format(script)) no_restraint_fn = fn + '/no_restraint/' if os.path.exists(no_restraint_fn): with temp_change_dir(no_restraint_fn): print(no_restraint_fn) os.system('python {}'.format(script)) except IndexError: pass
pdb_pattern = 'empty*.pdb' def run_tleap(code, pdbfile_root, tleap_template): leap_fn = 'tleap.{}.in'.format(pdbfile_root) with open(leap_fn, 'w') as fh: cm = tleap_template.format(pdbfile_root=pdbfile_root) fh.write(cm) os.system('tleap -f {}'.format(leap_fn)) os.remove(leap_fn) os.remove('log.{}'.format(pdbfile_root)) for code in PDBLIST: with temp_change_dir(code): try: # os.system('rm *.parm7') # os.system('cp {} ./{}.parm7'.format(parmfile, code)) # parmfile = glob('*.parm7')[0] # os.system('cp {parmfile} {code}.parm7'.format(parmfile=parmfile, code=code)) pdbfiles = glob(pdb_pattern) my_pdbfiles = get_commands_for_my_rank(pdbfiles, rank=rank) for pdbfile in my_pdbfiles: parm = pmd.load_file(pdbfile) pdbfile_root = pdbfile.replace('.pdb', '') fn = 'NoH_' + pdbfile new_parm = parm[[ index for index, atom in enumerate(parm.atoms) if atom.atomic_number != 1 ]]