Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Terminal fragment selector
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
tools
Terminal fragment selector
Commits
acd2a084
Commit
acd2a084
authored
1 year ago
by
Mate Balajti
Browse files
Options
Downloads
Patches
Plain Diff
refactor: update CLI
parent
c6b96e6b
No related branches found
No related tags found
1 merge request
!58
refactor: update CLI
Pipeline
#17249
passed
1 year ago
Stage: build
Stage: test
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README.md
+1
-2
1 addition, 2 deletions
README.md
setup.py
+10
-4
10 additions, 4 deletions
setup.py
term_frag_sel/cli.py
+8
-6
8 additions, 6 deletions
term_frag_sel/cli.py
term_frag_sel/utils.py
+1
-2
1 addition, 2 deletions
term_frag_sel/utils.py
tests/test_cli.py
+2
-2
2 additions, 2 deletions
tests/test_cli.py
with
22 additions
and
16 deletions
README.md
+
1
−
2
View file @
acd2a084
...
...
@@ -29,8 +29,7 @@ Output:
To install package, run
```
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install .
```
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
10
−
4
View file @
acd2a084
"""
Set up project.
"""
from
setuptools
import
setup
,
find_packages
from
pathlib
import
Path
from
setuptools
import
setup
,
find_packages
project_root_dir
=
Path
(
__file__
).
parent
.
resolve
()
with
open
(
project_root_dir
/
"
requirements.txt
"
,
"
r
"
,
encoding
=
"
utf-8
"
)
as
f
:
INSTALL_REQUIRES
=
f
.
read
().
splitlines
()
url
=
'
https://git.scicore.unibas.ch/zavolan_group/tools/terminal-fragment-selector
'
URL
=
(
'
https://git.scicore.unibas.ch/zavolan_group/
'
'
tools/terminal-fragment-selector
'
)
setup
(
name
=
'
terminal-fragment-selector
'
,
version
=
'
0.1.1
'
,
url
=
url
,
url
=
URL
,
license
=
'
MIT
'
,
author
=
'
Hugo Madge Leon, Sunho Kim, Tanya Nandan
'
,
author_email
=
'
hmadge@ethz.ch
'
,
description
=
'
Terminal fragment selector
'
,
packages
=
find_packages
(),
install_requires
=
INSTALL_REQUIRES
install_requires
=
INSTALL_REQUIRES
,
entry_points
=
{
'
console_scripts
'
:
[
'
terminal-fragment-selector=term_frag_sel.cli:main
'
]
}
)
This diff is collapsed.
Click to expand it.
term_frag_sel/cli.py
+
8
−
6
View file @
acd2a084
...
...
@@ -18,13 +18,15 @@ logging.basicConfig(
logger
=
logging
.
getLogger
(
"
main
"
)
def
main
(
args
:
argparse
.
Namespace
):
def
main
():
"""
Use CLI arguments to fragment sequences and output text file
\
with selected terminal fragments.
Args:
args (parser): list of arguments from CLI.
"""
args
=
parse_arguments
()
if
not
isinstance
(
args
,
argparse
.
Namespace
):
raise
TypeError
(
"
Input should be argparse.Namespace
"
)
...
...
@@ -38,8 +40,10 @@ def main(args: argparse.Namespace):
logger
.
info
(
"
Fragmentation of %s...
"
,
args
.
fasta
)
splits
=
np
.
arange
(
0
,
len
(
list
(
fasta
))
+
args
.
size
,
args
.
size
)
for
i
,
split
in
enumerate
(
splits
):
fasta_dict
=
fasta
[
split
:
splits
[
i
+
1
]]
for
i
in
range
(
len
(
splits
)
-
1
):
split
=
splits
[
i
]
keys
=
list
(
fasta
.
keys
())[
split
:
splits
[
i
+
1
]]
fasta_dict
=
{
key
:
fasta
[
key
]
for
key
in
keys
}
term_frags
=
fragmentation
(
fasta_dict
,
seq_counts
,
args
.
mean
,
args
.
std
)
...
...
@@ -132,6 +136,4 @@ if __name__ == '__main__':
level
=
logging
.
INFO
,
)
logger
=
logging
.
getLogger
(
__name__
)
arguments
=
parse_arguments
()
main
(
arguments
)
main
()
This diff is collapsed.
Click to expand it.
term_frag_sel/utils.py
+
1
−
2
View file @
acd2a084
...
...
@@ -23,5 +23,4 @@ def check_positive(value: str) -> int:
except
ValueError
as
exc
:
raise
argparse
.
ArgumentTypeError
(
f
"""
Expected positive integer,
got:
{
value
}
"""
)
from
exc
else
:
return
ivalue
return
ivalue
This diff is collapsed.
Click to expand it.
tests/test_cli.py
+
2
−
2
View file @
acd2a084
...
...
@@ -27,5 +27,5 @@ def test_file():
def
test_main
():
"""
Test main() function.
"""
with
pytest
.
raises
(
TypeError
):
main
(
""
)
with
pytest
.
raises
(
SystemExit
):
main
()
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