remove shell scripts run with subprocess() and launch foldx directly from python
This commit is contained in:
parent
9df3913a84
commit
86670bbac3
6 changed files with 86 additions and 17 deletions
|
@ -9,6 +9,7 @@ from pathlib import Path
|
|||
import re
|
||||
import csv
|
||||
import argparse
|
||||
import shutil
|
||||
#https://realpython.com/python-pathlib/
|
||||
|
||||
# FIXME
|
||||
|
@ -226,55 +227,123 @@ def main():
|
|||
#subprocess.check_output(['bash','repairPDB.sh', indir, actual_pdb_filename, process_dir])
|
||||
# once you decide to use the function
|
||||
# repairPDB(pdbname)
|
||||
|
||||
# FIXME: put this hack elsewhere
|
||||
foldx_common=' --ionStrength=0.05 --pH=7 --water=PREDICT --vdwDesign=1 '
|
||||
|
||||
subprocess.call(['foldx'
|
||||
, '--command=RepairPDB'
|
||||
, foldx_common
|
||||
, '--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('\033[95mSTAGE: run FoldX (subprocess)\033[0m')
|
||||
print('EXECUTING: runfoldx.sh %s %s ' % (pdbname, process_dir))
|
||||
output = subprocess.check_output(['bash', 'runfoldx.sh', pdbname, process_dir])
|
||||
print('\033[95mCOMPLETE: run FoldX (shell)\033[0m')
|
||||
#output = subprocess.check_output(['bash', 'runfoldx.sh', pdbname, process_dir])
|
||||
|
||||
print('Running foldx BuildModel')
|
||||
subprocess.call(['foldx'
|
||||
, '--command=BuildModel'
|
||||
, foldx_common
|
||||
, '--pdb-dir=' + process_dir
|
||||
, '--pdb=' + pdbname + '_Repair.pdb'
|
||||
, '--mutant-file="individual_list_' + pdbname +'.txt"'
|
||||
, 'outPDB=true'
|
||||
, '--numberOfRuns=1'
|
||||
, '--output-dir=' + process_dir], cwd=process_dir)
|
||||
|
||||
print('Running foldx PrintNetworks')
|
||||
subprocess.call(['foldx'
|
||||
, '--command=PrintNetworks'
|
||||
, '--pdb-dir=' + process_dir
|
||||
, '--pdb=' + pdbname + '_Repair.pdb'
|
||||
, '--water=PREDICT'
|
||||
, '--vdwDesign=1'
|
||||
, '--output-dir=' + process_dir], cwd=process_dir)
|
||||
|
||||
print('Running foldx SequenceDetail')
|
||||
subprocess.call(['foldx'
|
||||
, '--command=SequenceDetail'
|
||||
, '--pdb-dir=' + process_dir
|
||||
, '--pdb=' + pdbname + '_Repair.pdb'
|
||||
, '--water=PREDICT'
|
||||
, '--vdwDesign=1'
|
||||
, '--output-dir=' + process_dir], cwd=process_dir)
|
||||
|
||||
|
||||
print('\033[95mCOMPLETE: run FoldX (subprocess)\033[0m')
|
||||
|
||||
print('\033[95mSTAGE: Print Networks (shell)\033[0m')
|
||||
for n in range(1,nmuts+1):
|
||||
print('\033[95mNETWORK:\033[0m', n)
|
||||
print('\033[96mCommand:\033[0m runPrintNetworks.sh %s %s %s' % (pdbname, str(n), process_dir ))
|
||||
with suppress(Exception):
|
||||
subprocess.check_output(['bash', 'runPrintNetworks.sh', pdbname, str(n), process_dir])
|
||||
#print('\033[96mCommand:\033[0m runPrintNetworks.sh %s %s %s' % (pdbname, str(n), process_dir ))
|
||||
#with suppress(Exception):
|
||||
#foldx --command=PrintNetworks --pdb="${PDB}_Repair_${n}.pdb" --water=PREDICT --vdwDesign=1 --output-dir=${OUTDIR}
|
||||
print('Running foldx PrintNetworks for mutation', n)
|
||||
subprocess.call(['foldx'
|
||||
, '--command=PrintNetworks'
|
||||
, '--pdb-dir=' + process_dir
|
||||
, '--pdb=' + pdbname + '_Repair_' + str(n) + '.pdb'
|
||||
, '--water=PREDICT'
|
||||
, '--vdwDesign=1'
|
||||
, '--output-dir=' + process_dir], cwd=process_dir)
|
||||
#subprocess.check_output(['bash', 'runPrintNetworks.sh', pdbname, str(n), process_dir])
|
||||
print('\033[95mCOMPLETE: Print Networks (shell)\033[0m')
|
||||
|
||||
print('\033[95mSTAGE: Rename Mutation Files (shell)\033[0m')
|
||||
for n in range(1,nmuts+1):
|
||||
print('\033[95mMUTATION:\033[0m', n)
|
||||
print('\033[96mCommand:\033[0m mutrenamefiles.sh %s %s %s' % (pdbname, str(n), process_dir ))
|
||||
# FIXME: this is bad design and needs to be done in a pythonic way
|
||||
with suppress(Exception):
|
||||
subprocess.check_output(['bash', 'mutrenamefiles.sh', pdbname, str(n), process_dir])
|
||||
print('\033[95mCOMPLETE: Rename Mutation Files (shell)\033[0m')
|
||||
|
||||
print('\033[95mSTAGE: Rename Files (shell)\033[0m')
|
||||
# FIXME: this is bad design and needs to be done in a pythonic way
|
||||
out = subprocess.check_output(['bash','renamefiles.sh', pdbname, process_dir])
|
||||
print('\033[95mCOMPLETE: Rename Files (shell)\033[0m')
|
||||
|
||||
if comp=='y':
|
||||
print('\033[95mSTAGE: Run Complex (shell)\033[0m')
|
||||
print('\033[95mSTAGE: Running foldx AnalyseComplex (subprocess)\033[0m')
|
||||
chain1=chainA
|
||||
chain2=chainB
|
||||
with suppress(Exception):
|
||||
#with suppress(Exception):
|
||||
#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))
|
||||
subprocess.call(['foldx'
|
||||
, '--command=AnalyseComplex'
|
||||
, '--pdb-dir=' + process_dir
|
||||
, '--pdb=' + pdbname + '_Repair.pdb'
|
||||
, '--analyseComplexChains=' + chain1 + ',' + chain2
|
||||
, '--water=PREDICT'
|
||||
, '--vdwDesign=1'
|
||||
, '--output-dir=' + process_dir], cwd=process_dir)
|
||||
|
||||
# FIXME why would we ever need to do this?!? Cargo-culted from runcomplex.sh
|
||||
ac_source = process_dir + '/Summary_' + pdbname + '_Repair_AC.fxout'
|
||||
ac_dest = process_dir + '/Summary_' + pdbname + '_Repair_AC.txt'
|
||||
shutil.copyfile(ac_source, ac_dest)
|
||||
|
||||
for n in range(1,nmuts+1):
|
||||
print('\033[95mSTAGE: Run Mutation Complex (shell) for mutation:\033[0m', n)
|
||||
with suppress(Exception):
|
||||
subprocess.check_output(['bash','mutruncomplex.sh', pdbname, chain1, chain2, str(n), process_dir])
|
||||
print('\033[95mCOMPLETE: Run Complex (shell)\033[0m')
|
||||
print('\033[95mSTAGE: Running foldx AnalyseComplex (subprocess) for mutation:\033[0m', n)
|
||||
#with suppress(Exception):
|
||||
# subprocess.check_output(['bash','mutruncomplex.sh', pdbname, chain1, chain2, str(n), process_dir])
|
||||
subprocess.call(['foldx'
|
||||
, '--command=AnalyseComplex'
|
||||
, '--pdb-dir=' + process_dir
|
||||
, '--pdb=' + pdbname + '_Repair_' + str(n) + '.pdb'
|
||||
, '--analyseComplexChains=' + chain1 + ',' + chain2
|
||||
, '--water=PREDICT'
|
||||
, '--vdwDesign=1'
|
||||
, '--output-dir=' + process_dir], cwd=process_dir)
|
||||
|
||||
# FIXME why would we ever need to do this?!? Cargo-culted from runcomplex.sh
|
||||
ac_mut_source = process_dir + '/Summary_' + pdbname + '_Repair_' + str(n) +'_AC.fxout'
|
||||
ac_mut_dest = process_dir + '/Summary_' + pdbname + '_Repair)' + str(n) +'_AC.txt'
|
||||
shutil.copyfile(ac_mut_source, ac_mut_dest)
|
||||
print('\033[95mCOMPLETE: foldx AnalyseComplex (subprocess) for mutation:\033[0m', n)
|
||||
|
||||
interactions = ['Distances','Electro_RR','Electro_MM','Electro_SM','Electro_SS','Disulfide_RR','Disulfide_MM','Disulfide_SM','Disulfide_SS',
|
||||
'Hbonds_RR','Hbonds_MM','Hbonds_SM','Hbonds_SS','Partcov_RR','Partcov_MM','Partcov_SM','Partcov_SS','VdWClashes_RR','VdWClashes_MM',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue