From 946f9723b877154f4c60ebbb3ba8da3e80fa66a2 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Tue, 23 Jul 2019 19:02:17 +0200 Subject: [PATCH] ecotag: fixed a bug where the wrong taxid for the best match was retrieved --- src/obi_ecotag.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/obi_ecotag.c b/src/obi_ecotag.c index ca745e7..9f08941 100755 --- a/src/obi_ecotag.c +++ b/src/obi_ecotag.c @@ -394,8 +394,7 @@ int obi_ecotag(const char* dms_name, } // Check if the sequence columns share the same indexer (allows for quick checking of sequence equality) - // TODO check same dms - if (strcmp((query_seq_column->header)->indexer_name, (ref_seq_column->header)->indexer_name) == 0) + if ((strcmp((query_seq_column->header)->indexer_name, (ref_seq_column->header)->indexer_name) == 0) && (dms == ref_dms)) same_indexer = true; else same_indexer = false; @@ -466,12 +465,9 @@ int obi_ecotag(const char* dms_name, { // kmer filter (offset for the index of the kmer table of the 2nd sequence because the kmer tables of both the query and ref columns are concatenated in one) align_filters(ktable, blob1, blob2, i, query_count+j, threshold, true, ALILEN, true, &score, &lcs_min, !same_indexer); - // Compute alignment score if ((score < 0) && ((threshold == 0) || (score == -1.0))) // (sequences are not identical), and (no threshold, or filter passed): align - { score = obiblob_sse_banded_lcs_align(blob1, blob2, threshold, true, ALILEN, true, &lcs_length, &ali_length); - } } if ((score >= threshold) && (score >= best_score)) @@ -527,6 +523,8 @@ int obi_ecotag(const char* dms_name, } // Get LCA of the LCAs of the best matches + lca = NULL; + lca_taxid = -1; for (j=0; j= ecotag_threshold)) k++; @@ -572,7 +569,7 @@ int obi_ecotag(const char* dms_name, } else { - taxid_best_match = obi_get_int_with_elt_idx_and_col_p_in_view(ref_view, ref_taxid_column, j, 0); + taxid_best_match = obi_get_int_with_elt_idx_and_col_p_in_view(ref_view, ref_taxid_column, best_match_idx, 0); best_match = obi_taxo_get_taxon_with_taxid(taxonomy, taxid_best_match); if (best_match == NULL) { @@ -592,6 +589,7 @@ int obi_ecotag(const char* dms_name, } } + lca_name = NULL; if (best_match_count > 0) { assigned = true;