Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
e12c868d
Commit
e12c868d
authored
5 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
make Align functionality in dng independent of tmtools
Use the WrappedTMAlign instead
parent
bc3fb329
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/gui/pymod/init_context_menu.py
+18
-26
18 additions, 26 deletions
modules/gui/pymod/init_context_menu.py
with
18 additions
and
26 deletions
modules/gui/pymod/init_context_menu.py
+
18
−
26
View file @
e12c868d
...
...
@@ -7,7 +7,7 @@ import sip
from
ost
import
geom
,
gfx
,
gui
,
seq
from
ost
import
settings
from
ost
import
LogError
,
mol
from
ost.bindings
import
tmtools
from
ost.bindings
import
WrappedTMAlign
from
ost.bindings
import
msms
from
ost.seq
import
alg
import
ost
...
...
@@ -236,26 +236,12 @@ class SurfaceContextMenu(QtCore.QObject):
class
AlignmentContextMenu
(
QtCore
.
QObject
):
def
__init__
(
self
,
context_menu
):
try
:
try
:
# workaround for interrupted system call bug on OSX
if
platform
.
system
()
==
"
Windows
"
:
settings_name
=
"
tmalign.exe
"
else
:
settings_name
=
"
tmalign
"
except
IOError
:
# if platform.system() fails with an IOError we are most likely on a buggy mac an therefore
# use "tmalign"
settings_name
=
"
tmalign
"
settings
.
Locate
(
settings_name
)
QtCore
.
QObject
.
__init__
(
self
,
context_menu
.
qobject
)
self
.
action
=
QtWidgets
.
QAction
(
"
Align
"
,
self
)
self
.
action
.
triggered
.
connect
(
self
.
Align
)
context_menu
.
AddAction
(
self
.
action
,
gui
.
ContextActionType
.
ENTITY
|
gui
.
ContextActionType
.
MULTI
)
self
.
seq_viewer
=
None
except
settings
.
FileNotFound
:
return
QtCore
.
QObject
.
__init__
(
self
,
context_menu
.
qobject
)
self
.
action
=
QtWidgets
.
QAction
(
"
Align
"
,
self
)
self
.
action
.
triggered
.
connect
(
self
.
Align
)
context_menu
.
AddAction
(
self
.
action
,
gui
.
ContextActionType
.
ENTITY
|
gui
.
ContextActionType
.
MULTI
)
self
.
seq_viewer
=
None
def
Align
(
self
):
scene_selection
=
gui
.
SceneSelection
.
Instance
()
...
...
@@ -270,11 +256,11 @@ class AlignmentContextMenu(QtCore.QObject):
node
=
ent_list
[
0
]
res_list
=
list
()
if
isinstance
(
node
,
gfx
.
Entity
):
ref
=
node
.
view
.
ha
ndle
ref
=
node
.
view
.
c
ha
ins
[
0
]
for
i
in
range
(
1
,
len
(
ent_list
)):
node
=
ent_list
[
i
]
if
isinstance
(
node
,
gfx
.
Entity
):
res_list
.
append
(
tmtools
.
TMAlign
(
node
.
view
.
ha
ndle
,
ref
))
res_list
.
append
(
Wrapped
TMAlign
(
node
.
view
.
c
ha
ins
[
0
]
,
ref
))
node
.
UpdatePositions
()
if
show_scores
:
self
.
__ShowScore
(
ent_list
,
res_list
)
...
...
@@ -291,12 +277,18 @@ class AlignmentContextMenu(QtCore.QObject):
def
__DisplayAlignment
(
self
,
ent_list
,
res_list
):
if
(
len
(
res_list
)
>
0
):
ref_seq
=
seq
.
CreateSequence
(
"
%s (ref)
"
%
ent_list
[
0
].
GetName
(),
res_list
[
0
].
ref_sequence
.
GetGaplessString
())
ref_seq
=
seq
.
CreateSequence
(
"
%s (ref)
"
%
ent_list
[
0
].
GetName
(),
res_list
[
0
].
alignment
.
GetSequence
(
1
).
GetGaplessString
())
aln_list
=
seq
.
AlignmentList
()
if
(
ref_seq
.
IsValid
()):
for
i
in
range
(
0
,
len
(
res_list
)):
res_list
[
i
].
alignment
.
SetSequenceName
(
1
,
ent_list
[
i
+
1
].
GetName
())
aln_list
.
append
(
res_list
[
i
].
alignment
)
# WrappedTMAlign returns an alignment with second sequence
# being reference... let's swap...
new_aln
=
seq
.
CreateAlignment
()
new_aln
.
AddSequence
(
res_list
[
i
].
alignment
.
GetSequence
(
1
))
new_aln
.
AddSequence
(
res_list
[
i
].
alignment
.
GetSequence
(
0
))
new_aln
.
SetSequenceName
(
1
,
ent_list
[
i
+
1
].
GetName
())
aln_list
.
append
(
new_aln
)
alignment
=
alg
.
MergePairwiseAlignments
(
aln_list
,
ref_seq
)
gosty
=
gui
.
GostyApp
.
Instance
()
main_area
=
gosty
.
perspective
.
GetMainArea
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment