Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
panacota
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Amandine PERRIN
panacota
Commits
89a7186b
Commit
89a7186b
authored
4 years ago
by
Amandine PERRIN
Browse files
Options
Downloads
Patches
Plain Diff
complete util functions
parent
fa015c9a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
PanACoTA/utils.py
+3
-1
3 additions, 1 deletion
PanACoTA/utils.py
PanACoTA/utils_argparse.py
+13
-0
13 additions, 0 deletions
PanACoTA/utils_argparse.py
with
16 additions
and
1 deletion
PanACoTA/utils.py
+
3
−
1
View file @
89a7186b
...
@@ -522,6 +522,8 @@ def write_lstinfo(list_file, genomes, outdir):
...
@@ -522,6 +522,8 @@ def write_lstinfo(list_file, genomes, outdir):
for
genome
,
values
in
sorted
(
genomes
.
items
(),
key
=
sort_genomes_byname_l90_nbcont
):
for
genome
,
values
in
sorted
(
genomes
.
items
(),
key
=
sort_genomes_byname_l90_nbcont
):
gembase
,
_
,
to_annote
,
gsize
,
nbcont
,
l90
=
[
str
(
x
)
for
x
in
values
]
gembase
,
_
,
to_annote
,
gsize
,
nbcont
,
l90
=
[
str
(
x
)
for
x
in
values
]
outf
.
write
(
"
\t
"
.
join
([
gembase
,
genome
,
to_annote
,
gsize
,
nbcont
,
l90
])
+
"
\n
"
)
outf
.
write
(
"
\t
"
.
join
([
gembase
,
genome
,
to_annote
,
gsize
,
nbcont
,
l90
])
+
"
\n
"
)
return
outlst
def
sort_genomes_by_name
(
x
):
def
sort_genomes_by_name
(
x
):
"""
"""
...
@@ -943,7 +945,7 @@ def cat(list_files, output, title=None):
...
@@ -943,7 +945,7 @@ def cat(list_files, output, title=None):
widgets
=
[
title
+
'
:
'
,
progressbar
.
Bar
(
marker
=
'
█
'
,
left
=
''
,
right
=
''
,
fill
=
'
'
),
widgets
=
[
title
+
'
:
'
,
progressbar
.
Bar
(
marker
=
'
█
'
,
left
=
''
,
right
=
''
,
fill
=
'
'
),
'
'
,
progressbar
.
Counter
(),
f
"
/
{
nbfiles
}
"
'
(
'
,
'
'
,
progressbar
.
Counter
(),
f
"
/
{
nbfiles
}
"
'
(
'
,
progressbar
.
Percentage
(),
"
) -
"
,
progressbar
.
Timer
()]
progressbar
.
Percentage
(),
"
) -
"
,
progressbar
.
Timer
()]
bar
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
nbfiles
,
term_width
=
100
).
start
()
bar
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
nbfiles
,
term_width
=
79
).
start
()
curnum
=
1
curnum
=
1
with
open
(
output
,
"
w
"
)
as
outf
:
with
open
(
output
,
"
w
"
)
as
outf
:
for
file
in
list_files
:
for
file
in
list_files
:
...
...
This diff is collapsed.
Click to expand it.
PanACoTA/utils_argparse.py
+
13
−
0
View file @
89a7186b
...
@@ -43,6 +43,7 @@ April 2017
...
@@ -43,6 +43,7 @@ April 2017
from
PanACoTA
import
utils
from
PanACoTA
import
utils
import
argparse
import
argparse
def
gen_name
(
param
):
def
gen_name
(
param
):
if
not
utils
.
check_format
(
param
):
if
not
utils
.
check_format
(
param
):
msg
=
(
"
The genome name must contain 4 characters. For example, this name can
"
msg
=
(
"
The genome name must contain 4 characters. For example, this name can
"
...
@@ -136,3 +137,15 @@ def percentage(param):
...
@@ -136,3 +137,15 @@ def percentage(param):
"
be in [0, 1]. Invalid value: {}
"
.
format
(
param
))
"
be in [0, 1]. Invalid value: {}
"
.
format
(
param
))
raise
argparse
.
ArgumentTypeError
(
msg
)
raise
argparse
.
ArgumentTypeError
(
msg
)
return
param
return
param
def
perc_id
(
param
):
try
:
param
=
float
(
param
)
except
Exception
:
msg
=
"
argument -i percentage_id: invalid float value: {}
"
.
format
(
param
)
raise
argparse
.
ArgumentTypeError
(
msg
)
if
param
<
0
or
param
>
1
:
msg
=
(
"
The minimum %% of identity must be in [0, 1]. Invalid value: {}
"
.
format
(
param
))
raise
argparse
.
ArgumentTypeError
(
msg
)
return
param
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