diff --git a/python/obitools3/commands/count.pyx b/python/obitools3/commands/count.pyx index f769a77..b951ed1 100755 --- a/python/obitools3/commands/count.pyx +++ b/python/obitools3/commands/count.pyx @@ -29,6 +29,12 @@ def addOptions(parser): 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).") + group.add_argument('-c','--count-tag', + action="store", dest="count:countcol", + default='COUNT', + type=str, + help="Name of the tag/column associated with the count information (default: COUNT).") + def run(config): @@ -41,18 +47,20 @@ def run(config): if input is None: raise Exception("Could not read input") entries = input[1] - + + countcol = config['count']['countcol'] + count1 = len(entries) count2 = 0 - if COUNT_COLUMN in entries and ((config['count']['sequence'] == config['count']['all']) or (config['count']['all'])) : + if countcol in entries and ((config['count']['sequence'] == config['count']['all']) or (config['count']['all'])) : for e in entries: PyErr_CheckSignals() - count2+=e[COUNT_COLUMN] + count2+=e[countcol] - if COUNT_COLUMN in entries and (config['count']['sequence'] == config['count']['all']): + if countcol in entries and (config['count']['sequence'] == config['count']['all']): print(count1,count2) - elif COUNT_COLUMN in entries and config['count']['all']: + elif countcol in entries and config['count']['all']: print(count2) else: print(count1)