From 5fb025f310d9777876a37dec4dacbda622a3c6a4 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Mon, 28 Nov 2016 11:39:29 +0100 Subject: [PATCH] When aligning, it is now quickly checked whether the sequences are identical using their indexes --- src/obi_align.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/obi_align.c b/src/obi_align.c index 7f05bc2..eb89b5f 100644 --- a/src/obi_align.c +++ b/src/obi_align.c @@ -95,12 +95,26 @@ int obi_align_one_column(Obiview_p seq_view, OBIDMS_column_p seq_column, return -1; } - // kmer filter - align_filters(ktable, blob1, blob2, i, j, threshold, normalize, reference, similarity_mode, &score, &lcs_min); + // Check if the sequences are identical in a quick way (same index in the same indexer) + if (obi_get_index_with_elt_idx_and_col_p_in_view(seq_view, seq_column, i, 0) == obi_get_index_with_elt_idx_and_col_p_in_view(seq_view, seq_column, j, 0)) + { + if (similarity_mode && normalize) + score = 1.0; + else if (!similarity_mode) + score = 0.0; + else + score = blob1->length_decoded_value; + } - // Compute alignment score - if ((threshold == 0) || (score == -1.0)) // no threshold or filter passed, and sequences not identical: align - score = obiblob_sse_banded_lcs_align(blob1, blob2, threshold, normalize, reference, similarity_mode); + else // the sequences aren't identical + { + // kmer filter + align_filters(ktable, blob1, blob2, i, j, threshold, normalize, reference, similarity_mode, &score, &lcs_min, false); + + // Compute alignment score + if ((threshold == 0) || (score == -1.0)) // no threshold, or filter passed: align + score = obiblob_sse_banded_lcs_align(blob1, blob2, threshold, normalize, reference, similarity_mode); + } if ((score >= 0) && (((normalize || similarity_mode) && (score >= threshold)) || ((!similarity_mode && !normalize) && (score <= threshold)))) { // Print result