Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BIOINF588
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Etienne MORICE
BIOINF588
Commits
6227ecc3
Commit
6227ecc3
authored
6 years ago
by
Ariane Delrocq
Browse files
Options
Downloads
Patches
Plain Diff
testing align2steps; Closes #1
parent
9fad68fe
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
alignementseq_tests.py
+43
-0
43 additions, 0 deletions
alignementseq_tests.py
with
43 additions
and
0 deletions
alignementseq_tests.py
+
43
−
0
View file @
6227ecc3
...
...
@@ -123,6 +123,49 @@ class AlignmentSeqTestCase(unittest.TestCase):
print
(
ex_r1
)
print
(
ex_r2
)
raise
def
test_blosum_align2steps
(
self
):
"""
Tests alignments with blosum and gap extension.
"""
from
alignementseq
import
align2steps
for
s1
,
s2
,
filename
in
self
.
get_dataset_heads
():
(
ex_r1
,
ex_r2
,
exp_score
,
*
_
)
=
Bio
.
pairwise2
.
align
.
globaldd
(
s1
.
seq
,
s2
.
seq
,
blosum62
,
-
8
,
-
4
,
-
8
,
-
4
,
one_alignment_only
=
True
)[
0
]
score
,
r1
,
r2
=
align2steps
(
s1
,
s2
)
try
:
self
.
assertSameResidues
(
r1
.
seq
,
s1
.
seq
)
self
.
assertSameResidues
(
r2
.
seq
,
s2
.
seq
)
calc_score
=
0
# score calculated from r1 and r2
gap1
,
gap2
=
False
,
False
for
a
,
b
in
zip
(
r1
.
seq
,
r2
.
seq
):
if
a
==
'
-
'
:
if
not
gap1
:
gap1
=
True
gap2
=
False
# suppose 2 gaps are never aligned
calc_score
-=
8
else
:
calc_score
-=
4
elif
b
==
'
-
'
:
if
not
gap2
:
gap2
=
True
gap1
=
False
calc_score
-=
8
else
:
calc_score
-=
4
else
:
gap1
,
gap2
=
False
,
False
calc_score
+=
blosum62
[
a
,
b
]
if
(
a
,
b
)
in
blosum62
else
blosum62
[
b
,
a
]
self
.
assertEqual
(
score
,
calc_score
)
self
.
assertEqual
(
score
,
exp_score
)
except
AssertionError
:
print
(
'
from
'
,
filename
,
"
with
"
,
align2steps
,
"
:
"
)
print
(
r1
.
seq
)
print
(
r2
.
seq
)
print
(
''
)
print
(
ex_r1
)
print
(
ex_r2
)
raise
class
PerformanceTestCase
(
AlignmentSeqTestCase
):
"""
Performance tests, slow.
...
...
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