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
fb6ecdb9
Verified
Commit
fb6ecdb9
authored
6 years ago
by
Etienne MORICE
Browse files
Options
Downloads
Patches
Plain Diff
Closes #5
parent
67748c07
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
alignementseq.py
+7
-4
7 additions, 4 deletions
alignementseq.py
alignementseq_tests.py
+8
-5
8 additions, 5 deletions
alignementseq_tests.py
with
17 additions
and
11 deletions
.gitlab-ci.yml
+
2
−
2
View file @
fb6ecdb9
...
@@ -6,11 +6,11 @@ cache:
...
@@ -6,11 +6,11 @@ cache:
-
balibase/
-
balibase/
test
:
test
:
script
:
script
:
-
python3 -m unittest alignementseq_tests test_alignementseq_multiple
-
python3 -m unittest alignementseq_tests test_alignementseq_multiple
-v
test_performance
:
test_performance
:
script
:
script
:
-
python3 -m unittest alignementseq_tests.PerformanceTestCase
-
python3 -m unittest alignementseq_tests.PerformanceTestCase
-v
artifacts
:
artifacts
:
paths
:
paths
:
-
timings.png
-
timings.png
This diff is collapsed.
Click to expand it.
alignementseq.py
+
7
−
4
View file @
fb6ecdb9
...
@@ -164,20 +164,23 @@ def vec_align(seq1, seq2, mat=dict_to_weight(Bio.SubsMat.MatrixInfo.blosum62), g
...
@@ -164,20 +164,23 @@ def vec_align(seq1, seq2, mat=dict_to_weight(Bio.SubsMat.MatrixInfo.blosum62), g
S
[
0
][
0
]
=
0
S
[
0
][
0
]
=
0
S
[
1
][
0
]
=
gap
S
[
1
][
0
]
=
gap
S
[
1
][
1
]
=
gap
S
[
1
][
1
]
=
gap
x
*=
26
for
s
in
range
(
2
,
n
+
m
+
1
):
for
s
in
range
(
2
,
n
+
m
+
1
):
# First/last cell must be treated differently when first line/col of M
# First/last cell must be treated differently when first line/col of M
if
(
s
<=
m
):
if
(
s
<=
m
):
S
[
s
][
0
]
=
S
[
s
-
1
][
0
]
+
gap
S
[
s
][
0
]
=
S
[
s
-
1
][
0
]
+
gap
if
(
s
<=
n
):
if
(
s
<=
n
):
S
[
s
][
s
-
max
(
0
,
s
-
m
)]
=
S
[
s
-
1
][
s
-
1
-
max
(
0
,
s
-
1
-
m
)]
+
gap
S
[
s
][
s
-
max
(
0
,
s
-
m
)]
=
S
[
s
-
1
][
s
-
1
-
max
(
0
,
s
-
1
-
m
)]
+
gap
# The offsets in the formula become begin/end of slices.
# The offsets in the formula become begin/end of slices.
gapped
=
S
[
s
-
1
]
+
gap
S
[
s
][
int
(
s
<=
m
):
len
(
S
[
s
])
-
int
(
s
<=
n
)]
=
np
.
maximum
(
np
.
maximum
(
S
[
s
][
int
(
s
<=
m
):
len
(
S
[
s
])
-
int
(
s
<=
n
)]
=
np
.
maximum
(
np
.
maximum
(
S
[
s
-
1
][
1
:]
+
gap
,
gapped
[
1
:]
,
S
[
s
-
1
][:
-
1
]
+
gap
),
gapped
[:
-
1
]
),
S
[
s
-
2
][
int
(
s
>
m
+
1
):
len
(
S
[
s
-
2
])
-
int
(
s
>
n
+
1
)]
S
[
s
-
2
][
int
(
s
>
m
+
1
):
len
(
S
[
s
-
2
])
-
int
(
s
>
n
+
1
)]
+
mat
[
+
mat
[
x
[
max
(
0
,
s
-
m
-
1
):
min
(
n
,
s
-
1
)]
*
26
+
x
[
max
(
0
,
s
-
m
-
1
):
min
(
n
,
s
-
1
)]
+
y
[
max
(
0
,
s
-
n
-
1
):
min
(
m
,
s
-
1
)][::
-
1
]
y
[
max
(
0
,
s
-
n
-
1
):
min
(
m
,
s
-
1
)][::
-
1
]
]
]
)
)
...
...
This diff is collapsed.
Click to expand it.
alignementseq_tests.py
+
8
−
5
View file @
fb6ecdb9
...
@@ -19,11 +19,10 @@ import Bio.Entrez
...
@@ -19,11 +19,10 @@ import Bio.Entrez
from
Bio.SeqRecord
import
SeqRecord
from
Bio.SeqRecord
import
SeqRecord
from
Bio.SubsMat.MatrixInfo
import
blosum62
from
Bio.SubsMat.MatrixInfo
import
blosum62
class
AlignmentSeqTestCase
(
unittest
.
TestCase
):
class
BalibaseTestCase
(
unittest
.
TestCase
):
"""
Base class to inherit by all test cases that need access to the balibase.
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
unit_timeout
=
int
(
os
.
environ
.
get
(
"
UNIT_TIMEOUT
"
)
or
60
)
balibase_zippath
=
"
balibase.zip
"
balibase_zippath
=
"
balibase.zip
"
self
.
balibase_path
=
"
balibase
"
self
.
balibase_path
=
"
balibase
"
testfile_path
=
os
.
path
.
join
(
testfile_path
=
os
.
path
.
join
(
...
@@ -53,6 +52,8 @@ class AlignmentSeqTestCase(unittest.TestCase):
...
@@ -53,6 +52,8 @@ class AlignmentSeqTestCase(unittest.TestCase):
seq1
=
next
(
records
)
seq1
=
next
(
records
)
seq2
=
next
(
records
)
seq2
=
next
(
records
)
yield
seq1
,
seq2
,
filename
yield
seq1
,
seq2
,
filename
class
AlignmentSeqTestCase
(
BalibaseTestCase
):
def
get_dataset_records
(
self
):
def
get_dataset_records
(
self
):
"""
Generator function to iterate over the record generator of each
"""
Generator function to iterate over the record generator of each
...
@@ -212,7 +213,7 @@ class AlignmentSeqTestCase(unittest.TestCase):
...
@@ -212,7 +213,7 @@ class AlignmentSeqTestCase(unittest.TestCase):
Bio
.
SeqIO
.
write
((
r1
,
r2
),
fd
,
"
fasta
"
)
Bio
.
SeqIO
.
write
((
r1
,
r2
),
fd
,
"
fasta
"
)
class
PerformanceTestCase
(
AlignmentSeq
TestCase
):
class
PerformanceTestCase
(
Balibase
TestCase
):
"""
Performance tests, slow.
"""
Performance tests, slow.
Excluded from default test suite, run it with
Excluded from default test suite, run it with
...
@@ -224,6 +225,8 @@ class PerformanceTestCase(AlignmentSeqTestCase):
...
@@ -224,6 +225,8 @@ class PerformanceTestCase(AlignmentSeqTestCase):
"""
"""
super
().
setUp
()
super
().
setUp
()
self
.
unit_timeout
=
int
(
os
.
environ
.
get
(
"
UNIT_TIMEOUT
"
)
or
60
)
with
warnings
.
catch_warnings
():
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"
ignore
"
)
warnings
.
simplefilter
(
"
ignore
"
)
self
.
titin_human
,
self
.
titin_mouse
=
Bio
.
SeqIO
.
parse
(
self
.
titin_human
,
self
.
titin_mouse
=
Bio
.
SeqIO
.
parse
(
...
...
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