Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scRNA-seq-simulation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
zavolan_group
pipelines
scRNA-seq-simulation
Commits
485bdca3
Commit
485bdca3
authored
3 years ago
by
TheRiPtide
Browse files
Options
Downloads
Patches
Plain Diff
refactor: small changes to adjust style and format
parent
bcd472ba
No related branches found
No related tags found
1 merge request
!23
feat: deep-leaning poly(A) classifier
Pipeline
#13865
failed
3 years ago
Stage: qc
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/polyA_classifier/__init__.py
+1
-1
1 addition, 1 deletion
src/polyA_classifier/__init__.py
src/polyA_classifier/cli.py
+9
-7
9 additions, 7 deletions
src/polyA_classifier/cli.py
tests/test_poly_a.py
+6
-14
6 additions, 14 deletions
tests/test_poly_a.py
with
16 additions
and
22 deletions
src/polyA_classifier/__init__.py
+
1
−
1
View file @
485bdca3
"""
Modul
e for classifying poly(A) sequences.
"""
"""
Packag
e for classifying poly(A) sequences.
"""
This diff is collapsed.
Click to expand it.
src/polyA_classifier/cli.py
+
9
−
7
View file @
485bdca3
"""
Command-line interface for the poly(A) classifier.
"""
import
sys
import
argparse
from
sys
import
stdout
from
argparse
import
ArgumentParser
from
src.polyA_classifier.polyA_classifier
import
PolyAClassifier
parser
=
argparse
.
ArgumentParser
()
parser
=
ArgumentParser
()
parser
.
add_argument
(
'
data
'
,
action
=
'
store
'
,
help
=
'
str or list(str) of length 200 chars to classify.
'
)
parser
.
add_argument
(
'
-p
'
,
'
--path
'
,
action
=
'
store
'
,
help
=
'
Path to state-dict for Net-model.
'
,
default
=
'
./models/internal_priming.pth
'
)
if
__name__
==
'
__main__
'
:
def
main
():
args
=
parser
.
parse_args
()
if
args
.
data
[
0
]
==
'
[
'
:
...
...
@@ -26,5 +24,9 @@ if __name__ == '__main__':
classifier
=
PolyAClassifier
(
state_dict_path
=
args
.
path
)
result
=
classifier
.
classify
(
data
)
stdout
.
write
(
str
(
result
))
if
__name__
==
'
__main__
'
:
sys
.
stdout
.
write
(
str
(
result
)
)
main
(
)
This diff is collapsed.
Click to expand it.
tests/test_poly_a.py
+
6
−
14
View file @
485bdca3
"""
Tests for poly_a module.
"""
"""
Tests for poly_a package.
"""
import
pytest
import
os
from
src.poly_a
import
generate_poly_a
...
...
@@ -18,7 +17,7 @@ class TestGeneratePolyA():
def
test_passes_set_all_args
(
self
):
res
=
generate_poly_a
(
length
=
10
,
weights
=
(
1
,
0
,
0
,
0
),
weights
=
(
1
,
0
,
0
,
0
),
)
assert
isinstance
(
res
,
str
)
assert
len
(
res
)
==
10
...
...
@@ -40,10 +39,10 @@ class TestGeneratePolyA():
@pytest.mark.parametrize
(
"
weights, expected
"
,
[
((
0
,
0
,
1
),
ValueError
),
((
'
a
'
,
0
,
0
,
1
),
ValueError
),
((
0
,
0
,
0
,
-
1
),
ValueError
),
((
0
,
0
,
0
,
0
),
ValueError
),
((
0
,
0
,
1
),
ValueError
),
((
'
a
'
,
0
,
0
,
1
),
ValueError
),
((
0
,
0
,
0
,
-
1
),
ValueError
),
((
0
,
0
,
0
,
0
),
ValueError
),
]
)
def
test_wrong_weights
(
self
,
expected
,
weights
):
...
...
@@ -67,11 +66,7 @@ class TestClassifyPolyA:
]
)
def
test_passes_set_all_args
(
self
,
sample
,
expected
):
print
(
os
.
getcwd
())
model
=
PolyAClassifier
(
Net
,
'
./tests/resources/internal_priming_test_model.pth
'
)
pred
=
model
.
classify
(
sample
)
assert
pred
==
expected
...
...
@@ -84,7 +79,6 @@ class TestClassifyPolyA:
]
)
def
test_wrong_input_length
(
self
,
sample
,
expected
):
model
=
PolyAClassifier
(
state_dict_path
=
'
./tests/resources/internal_priming_test_model.pth
'
)
with
pytest
.
raises
(
expected
):
...
...
@@ -104,5 +98,3 @@ class TestClassifyPolyA:
with
pytest
.
raises
(
expected
):
model
.
classify
(
sample
)
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