From d4a7e3b6356403a0bf082dbf99252df72f949773 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Mon, 8 Feb 2021 16:59:42 +0000 Subject: [PATCH] modifying script to avoid invoking bash as a subprocess --- foldx/test2/runFoldx.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/foldx/test2/runFoldx.py b/foldx/test2/runFoldx.py index 23bed97..2ba784d 100755 --- a/foldx/test2/runFoldx.py +++ b/foldx/test2/runFoldx.py @@ -195,6 +195,19 @@ def loadFiles(df): f.close() 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(): pdbname = pdb_name @@ -210,7 +223,19 @@ def main(): #subprocess.check_output(['bash','repairPDB.sh', pdbname, process_dir]) print('\033[95mSTAGE: repair PDB\033[0m') 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[95mSTAGE: run FoldX (shell)\033[0m') print('EXECUTING: runfoldx.sh %s %s ' % (pdbname, process_dir)) @@ -242,7 +267,9 @@ def main(): chain1=chainA chain2=chainB 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): print('\033[95mSTAGE: Run Mutation Complex (shell) for mutation:\033[0m', n) with suppress(Exception):