modifying script to avoid invoking bash as a subprocess

This commit is contained in:
Tanushree Tunstall 2021-02-08 16:59:42 +00:00
parent fab1fb0492
commit d4a7e3b635

View file

@ -195,6 +195,19 @@ def loadFiles(df):
f.close() f.close()
return np.asarray(resultList, dtype=np.float32) return np.asarray(resultList, dtype=np.float32)
# TODO: use this code pattern rather than invoking bash
#def repairPDB():
# subprocess.call(['foldx'
# , '--command=RepairPDB'
# , '--pdb-dir=' + indir
# , '--pdb=' + actual_pdb_filename
# , '--ionStrength=0.05'#
# , '--pH=7'
# , '--water=PREDICT'
# , '--vdwDesign=1'
# , 'outPDB=true'
# , '--output-dir=' + process_dir])
#======================================================================= #=======================================================================
def main(): def main():
pdbname = pdb_name pdbname = pdb_name
@ -210,7 +223,19 @@ def main():
#subprocess.check_output(['bash','repairPDB.sh', pdbname, process_dir]) #subprocess.check_output(['bash','repairPDB.sh', pdbname, process_dir])
print('\033[95mSTAGE: repair PDB\033[0m') print('\033[95mSTAGE: repair PDB\033[0m')
print('EXECUTING: repairPDB.sh %s %s %s' % (indir, actual_pdb_filename, process_dir)) print('EXECUTING: repairPDB.sh %s %s %s' % (indir, actual_pdb_filename, process_dir))
subprocess.check_output(['bash','repairPDB.sh', indir, actual_pdb_filename, process_dir]) #subprocess.check_output(['bash','repairPDB.sh', indir, actual_pdb_filename, process_dir])
# once you decide to use the function
# repairPDB(pdbname)
subprocess.call(['foldx'
, '--command=RepairPDB'
, '--pdb-dir=' + indir
, '--pdb=' + actual_pdb_filename
, '--ionStrength=0.05'#
, '--pH=7'
, '--water=PREDICT'
, '--vdwDesign=1'
, 'outPDB=true'
, '--output-dir=' + process_dir])
print('\033[95mCOMPLETE: repair PDB\033[0m') print('\033[95mCOMPLETE: repair PDB\033[0m')
print('\033[95mSTAGE: run FoldX (shell)\033[0m') print('\033[95mSTAGE: run FoldX (shell)\033[0m')
print('EXECUTING: runfoldx.sh %s %s ' % (pdbname, process_dir)) print('EXECUTING: runfoldx.sh %s %s ' % (pdbname, process_dir))
@ -242,7 +267,9 @@ def main():
chain1=chainA chain1=chainA
chain2=chainB chain2=chainB
with suppress(Exception): with suppress(Exception):
subprocess.check_output(['bash','runcomplex.sh', pdbname, chain1, chain2, process_dir]) #subprocess.check_output(['bash','runcomplex.sh', pdbname, chain1, chain2, process_dir])
subprocess(['foldx --command=AnalyseComplex --pdb="%s_Repair.pdb" --analyseComplexChains=%s,%s --water=PREDICT --vdwDesign=1 --output-dir=%s'] % (pdbname, chain1, chain2, process_dir))
for n in range(1,nmuts+1): for n in range(1,nmuts+1):
print('\033[95mSTAGE: Run Mutation Complex (shell) for mutation:\033[0m', n) print('\033[95mSTAGE: Run Mutation Complex (shell) for mutation:\033[0m', n)
with suppress(Exception): with suppress(Exception):