diff --git a/modules/base/pymod/settings.py b/modules/base/pymod/settings.py index 29814963710f83b36736464f229701ea153df243..d4aaa710c7e86eed6385ba0115c8aebb1ff423ac 100644 --- a/modules/base/pymod/settings.py +++ b/modules/base/pymod/settings.py @@ -1,4 +1,4 @@ -import os +import os, platform import __main__ @@ -87,7 +87,10 @@ def Locate(file_name, explicit_file_name=None, search_paths=[], if search_system_paths: paths=os.getenv('PATH') - searched+=paths.split(':') + if platform.system() == "Windows": + searched+=paths.split(';') + else: + searched+=paths.split(':') for path in searched: for file_name in file_names: full_file_name=os.path.join(path, file_name) diff --git a/modules/bindings/pymod/tmtools.py b/modules/bindings/pymod/tmtools.py index b8ab2a26104692ce681fccfb80ddfe30c19fd104..a9c18a7075fac99e5b96d40a209c7013360219e4 100644 --- a/modules/bindings/pymod/tmtools.py +++ b/modules/bindings/pymod/tmtools.py @@ -28,7 +28,7 @@ tmalign: Y. Zhang and J. Skolnick, Nucl. Acids Res. 2005 33, 2302-9 Authors: Pascal Benkert, Marco Biasini """ -import subprocess, os, tempfile +import subprocess, os, tempfile, platform from ost import settings, io, geom def _SetupFiles(models): @@ -64,10 +64,14 @@ def _ParseTmAlign(lines): return TMAlignResult(rmsd, aln_length, tm_score, tf) def _RunTmAlign(tmalign, tmp_dir): - tmalign_path=settings.Locate('tmalign', explicit_file_name=tmalign) model1_filename=os.path.join(tmp_dir, 'model01.pdb') - model2_filename=os.path.join(tmp_dir, 'model02.pdb') - command="%s '%s' '%s'" %(tmalign_path, model1_filename, model2_filename) + model2_filename=os.path.join(tmp_dir, 'model02.pdb') + 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) + else: + tmalign_path=settings.Locate('tmalign', explicit_file_name=tmalign) + command="%s '%s' '%s'" %(tmalign_path, model1_filename, model2_filename) ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) lines=ps.stdout.readlines() if (len(lines))<22: @@ -104,10 +108,14 @@ def _ParseTmScore(lines): def _RunTmScore(tmscore, tmp_dir): - tmscore_path=settings.Locate('tmscore', explicit_file_name=tmscore) model1_filename=os.path.join(tmp_dir, 'model01.pdb') model2_filename=os.path.join(tmp_dir, 'model02.pdb') - command="%s '%s' '%s'" %(tmscore_path, model1_filename, model2_filename) + 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) + else: + tmscore_path=settings.Locate('tmscore', explicit_file_name=tmscore) + command="%s '%s' '%s'" %(tmscore_path, model1_filename, model2_filename) ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) lines=ps.stdout.readlines() if (len(lines))<22: diff --git a/modules/gui/pymod/init_context_menu.py b/modules/gui/pymod/init_context_menu.py index e2d68d1ce3fa7cf7584dafdf688647c31ef2538d..7cd032ca2a0b7fdd040a98363ef254ab60e49ebe 100644 --- a/modules/gui/pymod/init_context_menu.py +++ b/modules/gui/pymod/init_context_menu.py @@ -1,3 +1,5 @@ +import platform + from PyQt4 import QtCore, QtGui from ost import geom, gfx, gui @@ -105,7 +107,10 @@ class ShowResultDialog(QtGui.QDialog): class AlignmentContextMenu(QtCore.QObject): def __init__(self, context_menu): try: - settings.Locate('tmalign') + if platform.system() == "Windows": + settings.Locate("tmalign.exe") + else: + settings.Locate("tmalign") QtCore.QObject.__init__(self, context_menu.qobject) self.action = QtGui.QAction("Align", self)