ecotag: fixed a bug where the wrong taxid for the best match was
retrieved
This commit is contained in:
@ -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,13 +465,10 @@ 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<best_match_count; 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);
|
||||
|
||||
k = 0;
|
||||
|
||||
while ((k < lca_array_length) && (score_array[k] >= 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;
|
||||
|
Reference in New Issue
Block a user