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
2dc6b57c
Commit
2dc6b57c
authored
4 years ago
by
Amandine PERRIN
Browse files
Options
Downloads
Patches
Plain Diff
Move check type of argument (percentage) to utils_argparse.py
parent
a9b8567e
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/subcommands/corepers.py
+2
-13
2 additions, 13 deletions
PanACoTA/subcommands/corepers.py
PanACoTA/utils_argparse.py
+13
-0
13 additions, 0 deletions
PanACoTA/utils_argparse.py
with
15 additions
and
13 deletions
PanACoTA/subcommands/corepers.py
+
2
−
13
View file @
2dc6b57c
...
...
@@ -200,18 +200,7 @@ def build_parser(parser):
parser to configure in order to extract command-line arguments
"""
import
argparse
def
percentage
(
param
):
try
:
param
=
float
(
param
)
except
Exception
:
msg
=
"
argument -t tol: invalid float value: {}
"
.
format
(
param
)
raise
argparse
.
ArgumentTypeError
(
msg
)
if
param
<
0
or
param
>
1
:
msg
=
(
"
The minimum %% of genomes required in a family to be persistent must
"
"
be in [0, 1]. Invalid value: {}
"
.
format
(
param
))
raise
argparse
.
ArgumentTypeError
(
msg
)
return
param
from
PanACoTA
import
utils_argparse
# Create command-line parser for all options and arguments to give
required
=
parser
.
add_argument_group
(
'
Required arguments
'
)
...
...
@@ -221,7 +210,7 @@ def build_parser(parser):
help
=
(
"
Specify the output directory for your core/persistent genome.
"
),
default
=
"
.
"
)
optional
=
parser
.
add_argument_group
(
'
Optional arguments
'
)
optional
.
add_argument
(
"
-t
"
,
"
--tol
"
,
dest
=
"
tol
"
,
default
=
1
,
type
=
percentage
,
optional
.
add_argument
(
"
-t
"
,
"
--tol
"
,
dest
=
"
tol
"
,
default
=
1
,
type
=
utils_argparse
.
percentage
,
help
=
(
"
min %% of genomes having at least 1 member in a family to
"
"
consider the family as persistent (between 0 and 1,
"
"
default is 1 = 100%% of genomes = Core genome).
"
...
...
This diff is collapsed.
Click to expand it.
PanACoTA/utils_argparse.py
+
13
−
0
View file @
2dc6b57c
...
...
@@ -123,3 +123,16 @@ def mash_dist(param):
msg
=
f
"
error: mash distance must be between 0 and 1: invalid value:
'
{
param
}
'"
raise
argparse
.
ArgumentTypeError
(
msg
)
return
param
def
percentage
(
param
):
try
:
param
=
float
(
param
)
except
Exception
:
msg
=
"
argument -t tol: invalid float value: {}
"
.
format
(
param
)
raise
argparse
.
ArgumentTypeError
(
msg
)
if
param
<
0
or
param
>
1
:
msg
=
(
"
The minimum %% of genomes required in a family to be persistent 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