From eb913b2742797b72d3738c018c482fbe4a3b1793 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Sun, 15 Sep 2019 19:27:47 +0200 Subject: [PATCH] ecotag: trying to use a threshold lower than the ref db threshold now returns an error instead of a warning --- python/obitools3/commands/ecotag.pyx | 5 +++++ src/obi_ecotag.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/python/obitools3/commands/ecotag.pyx b/python/obitools3/commands/ecotag.pyx index d9270f6..89a27de 100755 --- a/python/obitools3/commands/ecotag.pyx +++ b/python/obitools3/commands/ecotag.pyx @@ -63,6 +63,11 @@ def run(config): ref_dms_name = ref[0].name ref_view_name = ref[1] + # Check that the threshold demanded is greater than or equal to the threshold used to build the reference database + if config['ecotag']['threshold'] < eval(i_dms[ref_view_name].comments["ref_db_threshold"]) : + print("Error: The threshold demanded (%f) is lower than the threshold used to build the reference database (%f).", + config['ecotag']['threshold'], i_dms[ref_view_name].comments["ref_db_threshold"]) + # Open the output: only the DMS output = open_uri(config['obi']['outputURI'], input=False, diff --git a/src/obi_ecotag.c b/src/obi_ecotag.c index ef14e0d..407a44c 100755 --- a/src/obi_ecotag.c +++ b/src/obi_ecotag.c @@ -365,10 +365,11 @@ int obi_ecotag(const char* dms_name, } free(db_threshold_str); if (ecotag_threshold < db_threshold) - fprintf(stderr, "\nWarning: The threshold demanded (%f) is lower than the threshold used to build the reference database (%f). " - "\n\tMeaning that the similarity *between reference sequences* below the ref db threshold will not be considered. " - "\n\tEcotag normally uses that similarity for better results but it works fine without it.\n\n", + { + fprintf(stderr, "\nError: The threshold demanded (%f) is lower than the threshold used to build the reference database (%f).\n\n", ecotag_threshold, db_threshold); + return -1; + } // Open the ID column of reference sequences ref_id_column = obi_view_get_column(ref_view, ID_COLUMN);