From 3fcf29a76f61624358ff22c926f53a486b8dd8e9 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Wed, 8 Aug 2018 19:51:05 +0200 Subject: [PATCH] More explicit predicate error when checking that sequences and qualities match --- src/obiview.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/obiview.c b/src/obiview.c index 2827b17..494bdb3 100644 --- a/src/obiview.c +++ b/src/obiview.c @@ -15,6 +15,8 @@ #include #include #include +#include + #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; } }