Skip to content
Snippets Groups Projects
Commit 215dd106 authored by stefan's avatar stefan
Browse files

Windwos, fix for tmtools

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2410 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 4716f0e6
Branches
Tags
No related merge requests found
import os import os, platform
import __main__ import __main__
...@@ -87,7 +87,10 @@ def Locate(file_name, explicit_file_name=None, search_paths=[], ...@@ -87,7 +87,10 @@ def Locate(file_name, explicit_file_name=None, search_paths=[],
if search_system_paths: if search_system_paths:
paths=os.getenv('PATH') paths=os.getenv('PATH')
searched+=paths.split(':') if platform.system() == "Windows":
searched+=paths.split(';')
else:
searched+=paths.split(':')
for path in searched: for path in searched:
for file_name in file_names: for file_name in file_names:
full_file_name=os.path.join(path, file_name) full_file_name=os.path.join(path, file_name)
......
...@@ -28,7 +28,7 @@ tmalign: Y. Zhang and J. Skolnick, Nucl. Acids Res. 2005 33, 2302-9 ...@@ -28,7 +28,7 @@ tmalign: Y. Zhang and J. Skolnick, Nucl. Acids Res. 2005 33, 2302-9
Authors: Pascal Benkert, Marco Biasini Authors: Pascal Benkert, Marco Biasini
""" """
import subprocess, os, tempfile import subprocess, os, tempfile, platform
from ost import settings, io, geom from ost import settings, io, geom
def _SetupFiles(models): def _SetupFiles(models):
...@@ -64,10 +64,14 @@ def _ParseTmAlign(lines): ...@@ -64,10 +64,14 @@ def _ParseTmAlign(lines):
return TMAlignResult(rmsd, aln_length, tm_score, tf) return TMAlignResult(rmsd, aln_length, tm_score, tf)
def _RunTmAlign(tmalign, tmp_dir): def _RunTmAlign(tmalign, tmp_dir):
tmalign_path=settings.Locate('tmalign', explicit_file_name=tmalign)
model1_filename=os.path.join(tmp_dir, 'model01.pdb') model1_filename=os.path.join(tmp_dir, 'model01.pdb')
model2_filename=os.path.join(tmp_dir, 'model02.pdb') model2_filename=os.path.join(tmp_dir, 'model02.pdb')
command="%s '%s' '%s'" %(tmalign_path, model1_filename, model2_filename) 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) ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
lines=ps.stdout.readlines() lines=ps.stdout.readlines()
if (len(lines))<22: if (len(lines))<22:
...@@ -104,10 +108,14 @@ def _ParseTmScore(lines): ...@@ -104,10 +108,14 @@ def _ParseTmScore(lines):
def _RunTmScore(tmscore, tmp_dir): def _RunTmScore(tmscore, tmp_dir):
tmscore_path=settings.Locate('tmscore', explicit_file_name=tmscore)
model1_filename=os.path.join(tmp_dir, 'model01.pdb') model1_filename=os.path.join(tmp_dir, 'model01.pdb')
model2_filename=os.path.join(tmp_dir, 'model02.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) ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
lines=ps.stdout.readlines() lines=ps.stdout.readlines()
if (len(lines))<22: if (len(lines))<22:
......
import platform
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from ost import geom, gfx, gui from ost import geom, gfx, gui
...@@ -105,7 +107,10 @@ class ShowResultDialog(QtGui.QDialog): ...@@ -105,7 +107,10 @@ class ShowResultDialog(QtGui.QDialog):
class AlignmentContextMenu(QtCore.QObject): class AlignmentContextMenu(QtCore.QObject):
def __init__(self, context_menu): def __init__(self, context_menu):
try: try:
settings.Locate('tmalign') if platform.system() == "Windows":
settings.Locate("tmalign.exe")
else:
settings.Locate("tmalign")
QtCore.QObject.__init__(self, context_menu.qobject) QtCore.QObject.__init__(self, context_menu.qobject)
self.action = QtGui.QAction("Align", self) self.action = QtGui.QAction("Align", self)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment