Skip to content
Snippets Groups Projects
Commit 11512ebf authored by stefan's avatar stefan
Browse files

Align dialog fix show alignment

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2568 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent b4e92f73
No related branches found
No related tags found
No related merge requests found
...@@ -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, seq from ost import settings, io, geom, seq
def _SetupFiles(models): def _SetupFiles(models):
...@@ -66,9 +66,9 @@ def _ParseTmAlign(lines): ...@@ -66,9 +66,9 @@ def _ParseTmAlign(lines):
seq1 = seq.CreateSequence("1",lines[20].strip()) seq1 = seq.CreateSequence("1",lines[20].strip())
seq2 = seq.CreateSequence("2",lines[22].strip()) seq2 = seq.CreateSequence("2",lines[22].strip())
alignment = seq.CreateAlignment() alignment = seq.CreateAlignment()
alignment.AddSequence(seq1)
alignment.AddSequence(seq2) alignment.AddSequence(seq2)
return TMAlignResult(rmsd, aln_length, tm_score, tf, seq1, alignment) alignment.AddSequence(seq1)
return TMAlignResult(rmsd, aln_length, tm_score, tf, seq2, alignment)
def _RunTmAlign(tmalign, tmp_dir): def _RunTmAlign(tmalign, tmp_dir):
model1_filename=os.path.join(tmp_dir, 'model01.pdb') model1_filename=os.path.join(tmp_dir, 'model01.pdb')
......
...@@ -122,6 +122,7 @@ class ShowResultDialog(QtGui.QDialog): ...@@ -122,6 +122,7 @@ class ShowResultDialog(QtGui.QDialog):
self.list.resizeColumnsToContents() self.list.resizeColumnsToContents()
class AlignmentContextMenu(QtCore.QObject): class AlignmentContextMenu(QtCore.QObject):
def __init__(self, context_menu): def __init__(self, context_menu):
try: try:
if platform.system() == "Windows": if platform.system() == "Windows":
...@@ -133,6 +134,7 @@ class AlignmentContextMenu(QtCore.QObject): ...@@ -133,6 +134,7 @@ class AlignmentContextMenu(QtCore.QObject):
self.action = QtGui.QAction("Align", self) self.action = QtGui.QAction("Align", self)
QtCore.QObject.connect(self.action,QtCore.SIGNAL("triggered()"), self.Align) QtCore.QObject.connect(self.action,QtCore.SIGNAL("triggered()"), self.Align)
context_menu.AddAction(self.action, gui.ContextActionType.ENTITY | gui.ContextActionType.MULTI) context_menu.AddAction(self.action, gui.ContextActionType.ENTITY | gui.ContextActionType.MULTI)
self.seq_viewer = None
except settings.FileNotFound: except settings.FileNotFound:
return return
...@@ -170,19 +172,25 @@ class AlignmentContextMenu(QtCore.QObject): ...@@ -170,19 +172,25 @@ class AlignmentContextMenu(QtCore.QObject):
def __DisplayAlignment(self, res_list): def __DisplayAlignment(self, res_list):
if(len(res_list)>0): if(len(res_list)>0):
ref_seq = res_list[0].ref_sequence ref_seq = seq.CreateSequence("REF",res_list[0].ref_sequence.GetGaplessString())
aln_list = seq.AlignmentList() aln_list = seq.AlignmentList()
if(ref_seq.IsValid()): if(ref_seq.IsValid()):
for res in res_list: for res in res_list:
print res.alignment.GetSequence(0)
print res.alignment.GetSequence(1)
print "----------------"
aln_list.append(res.alignment) aln_list.append(res.alignment)
alignment = alg.MergePairwiseAlignments(aln_list, ref_seq) alignment = alg.MergePairwiseAlignments(aln_list, ref_seq)
gosty = gui.GostyApp.Instance() gosty = gui.GostyApp.Instance()
main_area = gosty.perspective.GetMainArea() main_area = gosty.perspective.GetMainArea()
seq_viewer = gui.SequenceViewerV2(True) if self.seq_viewer:
gosty.AddWidgetToApp(str(ref_seq),seq_viewer) main_area.RemoveWidget(self.seq_viewer)
seq_viewer.AddAlignment(alignment) self.seq_viewer.qobject.close()
main_area.ShowSubWindow(seq_viewer) self.seq_viewer = gui.SequenceViewer(True)
self.seq_viewer.AddAlignment(alignment)
self.seq_viewer.ChangeDisplayMode("Highlight conservation 1")
self.seq_viewer.Show()
def _InitContextMenu(app): def _InitContextMenu(app):
cm=app.scene_win.GetContextMenu() cm=app.scene_win.GetContextMenu()
AlignmentContextMenu(cm) AlignmentContextMenu(cm)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment