Fixed 2 bugs when checking qualities matching sequences predicate: now
closing and reopening indexers so that they are mapped properly, and fixed memory leak when reading sequences
This commit is contained in:
@ -1418,6 +1418,30 @@ static char* view_check_qual_match_seqs(Obiview_p view)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Close and reopen indexers to remap them properly, because in writable mode they are mostly unmapped
|
||||
if (obi_close_indexer(qual_column->indexer) < 0)
|
||||
{
|
||||
obidebug(1, "\nError closing the quality indexer when checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
|
||||
return NULL;
|
||||
}
|
||||
qual_column->indexer = obi_open_avl_group(view->dms, (qual_column->header)->indexer_name);
|
||||
if (qual_column->indexer == NULL)
|
||||
{
|
||||
obidebug(1, "\nError reopening the quality indexer when checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
|
||||
return NULL;
|
||||
}
|
||||
if (obi_close_indexer(seq_column->indexer) < 0)
|
||||
{
|
||||
obidebug(1, "\nError closing the sequence indexer when checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
|
||||
return NULL;
|
||||
}
|
||||
seq_column->indexer = obi_open_avl_group(view->dms, (seq_column->header)->indexer_name);
|
||||
if (seq_column->indexer == NULL)
|
||||
{
|
||||
obidebug(1, "\nError reopening the sequence indexer when checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nb_elements_per_line = (qual_column->header)->nb_elements_per_line;
|
||||
// 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)
|
||||
@ -1432,7 +1456,6 @@ 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))
|
||||
{
|
||||
@ -1449,6 +1472,7 @@ static char* view_check_qual_match_seqs(Obiview_p view)
|
||||
obidebug(1, "\nError checking the predicate for view %s: The sequences and sequence quality arrays match.", (view->infos)->name);
|
||||
return NULL;
|
||||
}
|
||||
free(seq);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user