ecotag: fixed a bug where the wrong taxid for the best match was

retrieved
This commit is contained in:
Celine Mercier
2019-07-23 19:02:17 +02:00
parent 9752ff8494
commit 946f9723b8

View File

@ -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) // 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) && (dms == ref_dms))
if (strcmp((query_seq_column->header)->indexer_name, (ref_seq_column->header)->indexer_name) == 0)
same_indexer = true; same_indexer = true;
else else
same_indexer = false; 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) // 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); align_filters(ktable, blob1, blob2, i, query_count+j, threshold, true, ALILEN, true, &score, &lcs_min, !same_indexer);
// Compute alignment score // Compute alignment score
if ((score < 0) && ((threshold == 0) || (score == -1.0))) // (sequences are not identical), and (no threshold, or filter passed): align 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); score = obiblob_sse_banded_lcs_align(blob1, blob2, threshold, true, ALILEN, true, &lcs_length, &ali_length);
}
} }
if ((score >= threshold) && (score >= best_score)) 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 // Get LCA of the LCAs of the best matches
lca = NULL;
lca_taxid = -1;
for (j=0; j<best_match_count; j++) for (j=0; j<best_match_count; j++)
{ {
best_match_idx = best_match_array[j]; best_match_idx = best_match_array[j];
@ -535,7 +533,6 @@ int obi_ecotag(const char* dms_name,
score_array = obi_get_array_with_col_p_in_view(ref_view, score_a_column, best_match_idx, &lca_array_length); score_array = obi_get_array_with_col_p_in_view(ref_view, score_a_column, best_match_idx, &lca_array_length);
k = 0; k = 0;
while ((k < lca_array_length) && (score_array[k] >= ecotag_threshold)) while ((k < lca_array_length) && (score_array[k] >= ecotag_threshold))
k++; k++;
@ -572,7 +569,7 @@ int obi_ecotag(const char* dms_name,
} }
else 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); best_match = obi_taxo_get_taxon_with_taxid(taxonomy, taxid_best_match);
if (best_match == NULL) if (best_match == NULL)
{ {
@ -592,6 +589,7 @@ int obi_ecotag(const char* dms_name,
} }
} }
lca_name = NULL;
if (best_match_count > 0) if (best_match_count > 0)
{ {
assigned = true; assigned = true;