Commit 3fcf29a7 by Celine Mercier

More explicit predicate error when checking that sequences and qualities

match
parent 080a97cc
......@@ -15,6 +15,8 @@
#include <stdbool.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <inttypes.h>
#include "obiview.h"
#include "obidms.h"
......@@ -1381,7 +1383,7 @@ static char* view_check_qual_match_seqs(Obiview_p view)
if (column == NULL)
{
obi_set_errno(OBIVIEW_ERROR);
obidebug(1, "\nError getting a column to clone from the linked list of column pointers of a view");
obidebug(1, "\nError getting a column to clone from the linked list of column pointers of view %s", (view->infos)->name);
return NULL;
}
......@@ -1394,7 +1396,7 @@ static char* view_check_qual_match_seqs(Obiview_p view)
seq_column = obi_open_column(view->dms, ((qual_column->header)->associated_column).column_name, ((qual_column->header)->associated_column).version);
if (seq_column == NULL)
{
obidebug(1, "\nError checking the predicate: The sequences and sequence quality arrays match.");
obidebug(1, "\nError checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
return NULL;
}
......@@ -1402,7 +1404,7 @@ static char* view_check_qual_match_seqs(Obiview_p view)
// Check that the quality and the sequence columns have the same number of elements per line
if (nb_elements_per_line != (seq_column->header)->nb_elements_per_line)
{
obidebug(1, "\nError checking the predicate: The sequences and sequence quality arrays match.");
obidebug(1, "\nError checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
return NULL;
}
......@@ -1412,20 +1414,21 @@ static char* view_check_qual_match_seqs(Obiview_p view)
for (k=0; k < nb_elements_per_line; k++)
{
qual = obi_get_qual_int_with_elt_idx_and_col_p_in_view(view, qual_column, j, k, &qual_len);
seq = obi_get_seq_with_elt_idx_and_col_p_in_view(view, seq_column, j, k);
if ((qual != OBIQual_int_NA) && (seq != OBISeq_NA))
{
// Test that the lengths of the quality and the sequence are equal
if (qual_len != (int)strlen(seq))
{
obidebug(1, "\nError checking the predicate: The sequences and sequence quality arrays match.");
obidebug(1, "\nError checking the predicate for view %s: The sequences and sequence quality arrays match. \n%d, %s, %d", (view->infos)->name, j, seq, qual_len);
return NULL;
}
}
// Test if one value is NA and not the other
else if (((qual == OBIQual_int_NA) && (seq != OBISeq_NA)) || ((qual != OBIQual_int_NA) && (seq == OBISeq_NA)))
{
obidebug(1, "\nError checking the predicate: The sequences and sequence quality arrays match.");
obidebug(1, "\nError checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
return NULL;
}
}
......
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