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
283d4177
Commit
283d4177
authored
5 years ago
by
Amandine PERRIN
Browse files
Options
Downloads
Patches
Plain Diff
Update verbosity
Update logger creation (with a name!)
parent
a92e9d8c
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/prepare.py
+13
-14
13 additions, 14 deletions
PanACoTA/subcommands/prepare.py
PanACoTA/utils.py
+5
-4
5 additions, 4 deletions
PanACoTA/utils.py
with
18 additions
and
18 deletions
PanACoTA/subcommands/prepare.py
+
13
−
14
View file @
283d4177
...
@@ -43,10 +43,11 @@ def main(cmd, NCBI_species, NCBI_taxid, outdir, threads, no_refseq, only_mash, l
...
@@ -43,10 +43,11 @@ def main(cmd, NCBI_species, NCBI_taxid, outdir, threads, no_refseq, only_mash, l
Main method, constructing the draft dataset for the given species
Main method, constructing the draft dataset for the given species
verbosity:
verbosity:
- defaut 0 : stdout contains INFO, stderr contains ERROR.
- defaut 0 : stdout contains INFO, stderr contains ERROR, .log contains INFO and more, .log.err contains warning and more
- 1: stdout contains INFO, stderr contains WARNING and ERROR
- 1: same as 0 + WARNING in stderr
- 2: stdout contains (DEBUG), DETAIL and INFO, stderr contains WARNING and ERROR
- 2: same as 1 + DETAILS in stdout + DETAILS in .log.details
- >=15: Add DEBUG in stdout
- >=15: same as 2 + Add DEBUG in stdout + create .log.debug with everything from info to debug
Parameters
Parameters
----------
----------
...
@@ -74,10 +75,10 @@ def main(cmd, NCBI_species, NCBI_taxid, outdir, threads, no_refseq, only_mash, l
...
@@ -74,10 +75,10 @@ def main(cmd, NCBI_species, NCBI_taxid, outdir, threads, no_refseq, only_mash, l
lower limit of distance between 2 genomes to keep them
lower limit of distance between 2 genomes to keep them
verbose : int
verbose : int
verbosity:
verbosity:
defau
l
t
(0): info in stdout, error and more in stderr
-
defaut
0 : stdout contains INFO, stderr contains ERROR, .log contains INFO and more, .log.err contains warning and more
1 = add warnings
in stderr
- 1: same as 0 + WARNING
in stderr
2 = like
1 +
add
DETAIL
to
stdout
(by default only INFO)
- 2: same as
1 + DETAIL
S in
stdout
+ DETAILS in .log.details
>15: add debug to stdout
- >=15: same as 2 + Add DEBUG in stdout + create .log.debug with everything from info to debug
quiet : bool
quiet : bool
True if nothing must be sent to stdout/stderr, False otherwise
True if nothing must be sent to stdout/stderr, False otherwise
...
@@ -113,10 +114,8 @@ def main(cmd, NCBI_species, NCBI_taxid, outdir, threads, no_refseq, only_mash, l
...
@@ -113,10 +114,8 @@ def main(cmd, NCBI_species, NCBI_taxid, outdir, threads, no_refseq, only_mash, l
if
verbose
>=
15
:
if
verbose
>=
15
:
level
=
logging
.
DEBUG
level
=
logging
.
DEBUG
logfile_base
=
os
.
path
.
join
(
outdir
,
"
PanACoTA_prepare_{}
"
).
format
(
species_linked
)
logfile_base
=
os
.
path
.
join
(
outdir
,
"
PanACoTA_prepare_{}
"
).
format
(
species_linked
)
logfile_base
=
utils
.
init_logger
(
logfile_base
,
level
,
name
=
''
,
details
=
True
,
logfile_base
,
logger
=
utils
.
init_logger
(
logfile_base
,
level
,
'
prepare
'
,
details
=
True
,
verbose
=
verbose
,
quiet
=
quiet
)
verbose
=
verbose
,
quiet
=
quiet
)
logger
=
logging
.
getLogger
(
''
)
keyargs
=
{
'
section
'
:
'
refseq
'
,
'
file_format
'
:
'
fasta
'
,
'
output
'
:
'
/Users/aperrin/Softwares/gem-hub_src/PanACoTA/104099-out
'
,
'
parallel
'
:
1
,
'
group
'
:
'
bacteria
'
,
'
species_taxid
'
:
'
104099
'
}
logger
.
info
(
"
Command used
\n
\t
>
"
+
cmd
)
logger
.
info
(
"
Command used
\n
\t
>
"
+
cmd
)
message
=
f
"'
PanACoTA prepare
'
will run on
{
threads
}
"
message
=
f
"'
PanACoTA prepare
'
will run on
{
threads
}
"
...
@@ -235,7 +234,7 @@ def build_parser(parser):
...
@@ -235,7 +234,7 @@ def build_parser(parser):
"
of
'
N
'
stretches, put this value to this option.
"
))
"
of
'
N
'
stretches, put this value to this option.
"
))
helper
=
parser
.
add_argument_group
(
'
Others
'
)
helper
=
parser
.
add_argument_group
(
'
Others
'
)
helper
.
add_argument
(
"
-v
"
,
"
--verbose
"
,
dest
=
"
verbose
"
,
action
=
"
count
"
,
default
=
0
,
helper
.
add_argument
(
"
-v
"
,
"
--verbose
"
,
dest
=
"
verbose
"
,
action
=
"
count
"
,
default
=
0
,
help
=
"
Increase verbosity in stdout/stderr.
"
)
help
=
"
Increase verbosity in stdout/stderr
and log files
.
"
)
helper
.
add_argument
(
"
-q
"
,
"
--quiet
"
,
dest
=
"
quiet
"
,
action
=
"
store_true
"
,
default
=
False
,
helper
.
add_argument
(
"
-q
"
,
"
--quiet
"
,
dest
=
"
quiet
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
(
"
Do not display anything to stdout/stderr. log files will
"
help
=
(
"
Do not display anything to stdout/stderr. log files will
"
"
still be created.
"
))
"
still be created.
"
))
...
@@ -310,7 +309,7 @@ def check_args(parser, args):
...
@@ -310,7 +309,7 @@ def check_args(parser, args):
if
args
.
cutn
==
0
or
args
.
cutn
==
5
:
if
args
.
cutn
==
0
or
args
.
cutn
==
5
:
message
=
(
"
!! Your genomes will be split when sequence contains at
"
message
=
(
"
!! Your genomes will be split when sequence contains at
"
"
least {}
'
N
'
at a stretch. If you want to change this threshold, use
"
"
least {}
'
N
'
at a stretch. If you want to change this threshold, use
"
"'
--cutn
'
option (0 if you do not want to cut)
"
).
format
(
args
.
cutn
)
"'
--cutn
n
'
option (
n=
0 if you do not want to cut)
"
).
format
(
args
.
cutn
)
print
(
colored
(
message
,
"
yellow
"
))
print
(
colored
(
message
,
"
yellow
"
))
# Warn user about selection of genomes thresholds
# Warn user about selection of genomes thresholds
...
...
This diff is collapsed.
Click to expand it.
PanACoTA/utils.py
+
5
−
4
View file @
283d4177
...
@@ -56,10 +56,11 @@ def init_logger(logfile_base, level, name, details=False, verbose=0, quiet=False
...
@@ -56,10 +56,11 @@ def init_logger(logfile_base, level, name, details=False, verbose=0, quiet=False
if we need to name the logger (used for tests)
if we need to name the logger (used for tests)
verbose : int
verbose : int
be more verbose:
be more verbose:
default (0): info in stdout, error and more in stderr
default (0): info in stdout, error and more in stderr ;
info and more in *.log ; warning and more in *.log.err
1 = add warnings in stderr
1 = add warnings in stderr
2 = like 1 + add
DETAIL
to stdout (by default only INFO)
2 = like 1 + add
details
to stdout (by default only INFO)
+ add details to *.log.details
>15: add debug to stdout
>15: add debug to stdout
and create *.log.debug with all levels
quiet : bool
quiet : bool
True if nothing must be sent to stdout/stderr, False otherwise
True if nothing must be sent to stdout/stderr, False otherwise
"""
"""
...
@@ -171,7 +172,7 @@ def init_logger(logfile_base, level, name, details=False, verbose=0, quiet=False
...
@@ -171,7 +172,7 @@ def init_logger(logfile_base, level, name, details=False, verbose=0, quiet=False
err_handler
.
setLevel
(
logging
.
ERROR
)
# write all messages >= ERROR
err_handler
.
setLevel
(
logging
.
ERROR
)
# write all messages >= ERROR
err_handler
.
setFormatter
(
formatter_stream
)
err_handler
.
setFormatter
(
formatter_stream
)
logger
.
addHandler
(
err_handler
)
# add handler to logger
logger
.
addHandler
(
err_handler
)
# add handler to logger
return
logfile
return
logfile
,
logger
class
LessThanFilter
(
logging
.
Filter
):
class
LessThanFilter
(
logging
.
Filter
):
...
...
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