From 03c174fd7a7749ecdc13b83b7f380a083c9cd962 Mon Sep 17 00:00:00 2001 From: mercierc Date: Mon, 31 May 2021 17:03:39 +1200 Subject: [PATCH] grep: added taxonomy check --- python/obitools3/commands/grep.pyx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/obitools3/commands/grep.pyx b/python/obitools3/commands/grep.pyx index 09ce295..c3555ec 100644 --- a/python/obitools3/commands/grep.pyx +++ b/python/obitools3/commands/grep.pyx @@ -258,6 +258,13 @@ def Filter_generator(options, tax_filter, i_view): def Taxonomy_filter_generator(taxo, options): + + if (("required_ranks" in options and options["required_ranks"]) or \ + ("required_taxids" in options and options["required_taxids"]) or \ + ("ignored_taxids" in options and options["ignored_taxids"])) and \ + (taxo is None): + raise RollbackException("obi grep error: can't use taxonomy options without providing a taxonomy. Rollbacking view") + if taxo is not None: def tax_filter(seq): good = True