Commit 8e92bf6d by Celine Mercier

LCS alignment: it is now checked that sequences are not longer than what

a 16 bits integer can code for (as the LCS and alignment lengths are
kept in 16 bits registers)
parent 30e4359c
......@@ -900,6 +900,14 @@ double generic_sse_banded_lcs_align(char* seq1, char* seq2, double threshold, bo
lmin = l1;
}
// Check that the sequences are not greater than what can be aligned using the 16 bits registers (as the LCS and alignment lengths are kept on 16 bits)
if (lmax > SHRT_MAX)
{
obi_set_errno(OBI_ALIGN_ERROR);
obidebug(1, "\nError: can not align sequences longer than %d (as the LCS and alignment lengths are kept on 16 bits)", SHRT_MAX);
return 0; // TODO DOUBLE_MIN to flag error
}
// If the score is expressed as a normalized distance, get the corresponding identity
if (!similarity_mode && normalize)
threshold = 1.0 - threshold;
......@@ -995,6 +1003,14 @@ double obiblob_sse_banded_lcs_align(Obi_blob_p seq1, Obi_blob_p seq2, double thr
lmin = l1;
}
// Check that the sequences are not greater than what can be aligned using the 16 bits registers (as the LCS and alignment lengths are kept on 16 bits)
if (lmax > SHRT_MAX)
{
obi_set_errno(OBI_ALIGN_ERROR);
obidebug(1, "\nError: can not align sequences longer than %d (as the LCS and alignment lengths are kept on 16 bits)", SHRT_MAX);
return 0; // TODO DOUBLE_MIN to flag error
}
// If the score is expressed as a normalized distance, get the corresponding identity
if (!similarity_mode && normalize)
threshold = 1.0 - threshold;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment