From 14a257917378e72a01f91621024c5049e50e326e Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Wed, 10 Jun 2020 17:47:26 +0200 Subject: [PATCH] uniq: now outputs an empty view if input view is empty instead of displaying an error --- python/obitools3/commands/uniq.pyx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/obitools3/commands/uniq.pyx b/python/obitools3/commands/uniq.pyx index 48385b4..d8f6f93 100644 --- a/python/obitools3/commands/uniq.pyx +++ b/python/obitools3/commands/uniq.pyx @@ -591,10 +591,11 @@ def run(config): # Initialize the progress bar pb = ProgressBar(len(entries), config, seconde=5) - try: - uniq_sequences(entries, o_view, pb, config, mergedKeys_list=config['uniq']['merge'], taxonomy=taxo, mergeIds=config['uniq']['mergeids'], categories=config['uniq']['categories'], max_elts=config['obi']['maxelts']) - except Exception, e: - raise RollbackException("obi uniq error, rollbacking view: "+str(e), o_view) + if len(entries) > 0: + try: + uniq_sequences(entries, o_view, pb, config, mergedKeys_list=config['uniq']['merge'], taxonomy=taxo, mergeIds=config['uniq']['mergeids'], categories=config['uniq']['categories'], max_elts=config['obi']['maxelts']) + except Exception, e: + raise RollbackException("obi uniq error, rollbacking view: "+str(e), o_view) print("", file=sys.stderr)