From b926ca3997235231ef8c6b2a900949546f466780 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Mon, 28 Mar 2016 15:04:06 +0200 Subject: [PATCH] A template for a command --- python/obitools3/commands/__init__.py | 0 python/obitools3/commands/count.py | 44 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 python/obitools3/commands/__init__.py create mode 100644 python/obitools3/commands/count.py diff --git a/python/obitools3/commands/__init__.py b/python/obitools3/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python/obitools3/commands/count.py b/python/obitools3/commands/count.py new file mode 100644 index 0000000..28bd996 --- /dev/null +++ b/python/obitools3/commands/count.py @@ -0,0 +1,44 @@ +''' +Created on 8 mars 2016 + +@author: coissac +''' + +from obitools3.apps.progress import ProgressBar # @UnresolvedImport +import time + +__title__="Counts sequences in a sequence set" + + +default_config = { 'countmode' : None + } + +def addOptions(parser): + parser.add_argument(dest='obi:input', metavar='obi:input', + nargs='?', + default=None, + help='input data set' ) + + group=parser.add_argument_group('Obicount specific options') + group.add_argument('-s','--sequence', + action="store_true", dest="count:sequence", + default=False, + help="Prints only the number of sequence records." + ) + + group.add_argument('-a','--all', + action="store_true", dest="count:all", + default=False, + help="Prints only the total count of sequence records (if a sequence has no `count` attribute, its default count is 1) (default: False)." + ) + + + +def run(config): + # The code of my command + pb = ProgressBar(1000,config,seconde=1) + + for i in range(1,1001): + pb(i) + time.sleep(0.01) +