Skip to content
Snippets Groups Projects
Commit 2ac197c7 authored by marco's avatar marco
Browse files

parse and return detailed info for tmalign

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2015 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent abba7e6e
Branches
No related tags found
No related merge requests found
...@@ -41,8 +41,19 @@ def _SetupFiles(models): ...@@ -41,8 +41,19 @@ def _SetupFiles(models):
def _CleanupFiles(dir_name): def _CleanupFiles(dir_name):
import shutil import shutil
shutil.rmtree(dir_name) shutil.rmtree(dir_name)
class TMAlignResult:
def __init__(self, rmsd, tm_score, aligned_length, transform):
self.rmsd=rmsd
self.tm_score=tm_score
self.aligned_length=aligned_length
self.transform=transform
def _ParseTmAlign(lines): def _ParseTmAlign(lines):
info_line=lines[11].split(',')
aln_length=float(info_line[0].split('=')[1].strip())
rmsd=float(info_line[1].split('=')[1].strip())
tm_score=float(info_line[2].split('=')[1].strip())
tf1=[float(i.strip()) for i in lines[15].split()] tf1=[float(i.strip()) for i in lines[15].split()]
tf2=[float(i.strip()) for i in lines[16].split()] tf2=[float(i.strip()) for i in lines[16].split()]
tf3=[float(i.strip()) for i in lines[17].split()] tf3=[float(i.strip()) for i in lines[17].split()]
...@@ -50,7 +61,7 @@ def _ParseTmAlign(lines): ...@@ -50,7 +61,7 @@ def _ParseTmAlign(lines):
tf2[4], tf3[2], tf3[3], tf3[4]) tf2[4], tf3[2], tf3[3], tf3[4])
tf=geom.Mat4(rot) tf=geom.Mat4(rot)
tf.PasteTranslation(geom.Vec3(tf1[1], tf2[1], tf3[1])) tf.PasteTranslation(geom.Vec3(tf1[1], tf2[1], tf3[1]))
return 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) tmalign_path=settings.Locate('tmalign', explicit_file_name=tmalign)
...@@ -108,10 +119,10 @@ def TMAlign(model1, model2, tmalign=None): ...@@ -108,10 +119,10 @@ def TMAlign(model1, model2, tmalign=None):
Run tmalign on two protein structures Run tmalign on two protein structures
""" """
tmp_dir_name=_SetupFiles((model1, model2)) tmp_dir_name=_SetupFiles((model1, model2))
tf=_RunTmAlign(tmalign, tmp_dir_name) result=_RunTmAlign(tmalign, tmp_dir_name)
model1.handle.RequestXCSEditor().ApplyTransform(tf) model1.handle.RequestXCSEditor().ApplyTransform(result.transform)
_CleanupFiles(tmp_dir_name) _CleanupFiles(tmp_dir_name)
return result
def TMScore(model1, model2, tmscore=None): def TMScore(model1, model2, tmscore=None):
""" """
Run tmscore on two protein structures Run tmscore on two protein structures
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment