From 0e46a276ac4f1bd8ad3cf6c101f2b83ced716413 Mon Sep 17 00:00:00 2001 From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Thu, 17 Jun 2010 15:30:17 +0000 Subject: [PATCH] fixes tmalign and tmtools subprocess calls (works on linux and windows) please test it on mac git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2418 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/bindings/pymod/tmtools.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/modules/bindings/pymod/tmtools.py b/modules/bindings/pymod/tmtools.py index a8aae7100..9117b675d 100644 --- a/modules/bindings/pymod/tmtools.py +++ b/modules/bindings/pymod/tmtools.py @@ -69,15 +69,12 @@ def _RunTmAlign(tmalign, tmp_dir): if platform.system() == "Windows": tmalign_path=settings.Locate('tmalign.exe', explicit_file_name=tmalign) command="\"%s\" %s %s" %(os.path.normpath(tmalign_path), model1_filename, model2_filename) - command=command+" > "+tmp_dir+"/tmalign_output" else: tmalign_path=settings.Locate('tmalign', explicit_file_name=tmalign) command="%s '%s' '%s'" %(tmalign_path, model1_filename, model2_filename) - command=command+" > "+tmp_dir+"/tmalign_output" - ps=subprocess.call(command, shell=True, stdout=subprocess.PIPE) - tmalign_f=open(tmp_dir+"/tmalign_output","r") - lines=tmalign_f.readlines() - tmalign_f.close() + ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + ps.wait() + lines=ps.stdout.readlines() if (len(lines))<22: raise RuntimeError("tmalign superposition failed") return _ParseTmAlign(lines) @@ -117,15 +114,12 @@ def _RunTmScore(tmscore, tmp_dir): if platform.system() == "Windows": tmscore_path=settings.Locate('tmscore.exe', explicit_file_name=tmscore) command="\"%s\" %s %s" %(os.path.normpath(tmscore_path), model1_filename, model2_filename) - command=command+" > "+tmp_dir+"/tmscore_output" else: tmscore_path=settings.Locate('tmscore', explicit_file_name=tmscore) command="%s '%s' '%s'" %(tmscore_path, model1_filename, model2_filename) - command=command+" > "+tmp_dir+"/tmscore_output" ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) - tmscore_f=open(tmp_dir+"/tmscore_output","r") - lines=tmscore_f.readlines() - tmscore_f.close() + ps.wait() + lines=ps.stdout.readlines() if (len(lines))<22: raise RuntimeError("tmscore superposition failed") return _ParseTmScore(lines) -- GitLab