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
17c0571f
Verified
Commit
17c0571f
authored
6 years ago
by
Etienne MORICE
Browse files
Options
Downloads
Patches
Plain Diff
Refactor to use unittest and gitlab-ci (1)
parent
cab18201
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
.gitlab-ci.yml
+9
-0
9 additions, 0 deletions
.gitlab-ci.yml
alignementseq.py
+1
-2
1 addition, 2 deletions
alignementseq.py
alignementseq_tests.py
+44
-0
44 additions, 0 deletions
alignementseq_tests.py
requirements.txt
+1
-0
1 addition, 0 deletions
requirements.txt
with
57 additions
and
2 deletions
.gitignore
+
2
−
0
View file @
17c0571f
*.swp
balibase/
__pycache__/
balibase.zip
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
0 → 100644
+
9
−
0
View file @
17c0571f
before_script
:
-
python3 -m pip install -r requirements.txt
cache
:
paths
:
-
balibase/
test
:
script
:
-
python3 -m unittest alignementseq_tests.py
This diff is collapsed.
Click to expand it.
alignementseq.py
+
1
−
2
View file @
17c0571f
...
...
@@ -38,7 +38,7 @@ def score(a, b, gap=-8, id=1, mut=-1):
# else:
# return mut
def
align
(
seq1
,
seq2
):
def
align
(
seq1
,
seq2
,
score
=
score
):
x
=
seq1
.
seq
y
=
seq2
.
seq
n
=
len
(
x
)
...
...
@@ -246,4 +246,3 @@ def test():
print
(
s
)
print
(
x
)
print
(
y
)
test
()
This diff is collapsed.
Click to expand it.
alignementseq_tests.py
0 → 100644
+
44
−
0
View file @
17c0571f
import
unittest
import
urllib.request
import
os
import
zipfile
from
Bio.SeqRecord
import
SeqRecord
class
AlignmentSeqTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
balibase_zippath
=
"
balibase.zip
"
balibase_path
=
"
balibase
"
testfile_path
=
os
.
path
.
join
(
balibase_path
,
"
RV11.unaligned
"
,
"
BBS11001.fasta
"
)
if
not
os
.
path
.
isdir
(
balibase_path
):
os
.
mkdir
(
balibase_path
)
if
not
os
.
path
.
isfile
(
testfile_path
):
if
not
os
.
path
.
isfile
(
balibase_zippath
):
print
(
"
Fetching balibase archive from moodle...
"
)
urllib
.
request
.
urlretrieve
(
"
https://moodle.polytechnique.fr/mod/resource/view.php?id=38570
"
,
balibase_zippath
)
with
zipfile
.
ZipFile
(
balibase_zippath
)
as
balibase_zip
:
balibase_zip
.
extractall
()
def
test_simple_align
(
self
):
from
alignementseq
import
align
score_fn
=
lambda
a
,
b
:
-
2
if
a
==
''
or
b
==
''
else
-
1
if
a
!=
b
else
1
cases
=
[
(
"
CHAT
"
,
"
CAT
"
,
1
,
"
CHAT
"
,
"
C-AT
"
),
(
"
CHAT
"
,
"
CGAT
"
,
2
,
"
CHAT
"
,
"
CGAT
"
),
(
"
CHAT
"
,
"
AT
"
,
-
2
,
"
CHAT
"
,
"
--AT
"
)
]
for
s1
,
s2
,
exp_score
,
exp_r1
,
exp_r2
in
cases
:
score
,
r1
,
r2
=
align
(
SeqRecord
(
s1
),
SeqRecord
(
s2
),
score_fn
)
self
.
assertEqual
(
score
,
exp_score
)
self
.
assertEqual
(
r1
.
seq
,
exp_r1
)
self
.
assertEqual
(
r2
.
seq
,
exp_r2
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
requirements.txt
0 → 100644
+
1
−
0
View file @
17c0571f
biopython
==1.73
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