Quality columns are now optional in NUC_SEQS views + minor fixes
This commit is contained in:
@ -1134,7 +1134,7 @@ Obiview_p obi_new_view_cloned_from_name(OBIDMS_p dms, const char* view_name, con
|
||||
}
|
||||
|
||||
|
||||
Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p view_to_clone, index_t* line_selection, const char* comments)
|
||||
Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p view_to_clone, index_t* line_selection, const char* comments, bool quality_column)
|
||||
{
|
||||
Obiview_p view;
|
||||
OBIDMS_column_p associated_nuc_column;
|
||||
@ -1176,30 +1176,41 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
|
||||
return NULL;
|
||||
}
|
||||
// Adding quality column
|
||||
associated_nuc_column = obi_view_get_column(view, NUC_SEQUENCE_COLUMN);
|
||||
if (obi_view_add_column(view, QUALITY_COLUMN, -1, QUALITY_COLUMN, OBI_QUAL, 0, 1, QUALITY_COLUMN, "", (associated_nuc_column->header)->name, (associated_nuc_column->header)->version, "Sequence qualities", true) < 0) // TODO discuss automatic association
|
||||
if (quality_column)
|
||||
{
|
||||
obidebug(1, "Error adding an obligatory column in a nucleotide sequences view");
|
||||
return NULL;
|
||||
associated_nuc_column = obi_view_get_column(view, NUC_SEQUENCE_COLUMN);
|
||||
if (obi_view_add_column(view, QUALITY_COLUMN, -1, QUALITY_COLUMN, OBI_QUAL, 0, 1, QUALITY_COLUMN, "", (associated_nuc_column->header)->name, (associated_nuc_column->header)->version, "Sequence qualities", true) < 0) // TODO discuss automatic association
|
||||
{
|
||||
obidebug(1, "Error adding an obligatory column in a nucleotide sequences view");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add predicate functions of the view type
|
||||
view->nb_predicates = 5; // TODO macro?
|
||||
// TODO macros?
|
||||
|
||||
if (quality_column)
|
||||
view->nb_predicates = 5;
|
||||
else
|
||||
view->nb_predicates = 3;
|
||||
|
||||
view->predicate_functions = malloc((view->nb_predicates) * sizeof(char* (*) (bool)));
|
||||
|
||||
(view->predicate_functions)[0] = view_has_nuc_sequence_column;
|
||||
(view->predicate_functions)[1] = view_has_quality_column;
|
||||
(view->predicate_functions)[2] = view_has_id_column;
|
||||
(view->predicate_functions)[3] = view_has_definition_column;
|
||||
(view->predicate_functions)[4] = view_check_quality_matches_seq_column;
|
||||
(view->predicate_functions)[1] = view_has_id_column;
|
||||
(view->predicate_functions)[2] = view_has_definition_column;
|
||||
if (quality_column)
|
||||
{
|
||||
(view->predicate_functions)[3] = view_has_quality_column;
|
||||
(view->predicate_functions)[4] = view_check_quality_matches_seq_column;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_name, const char* view_to_clone_name, index_t* line_selection, const char* comments)
|
||||
Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_name, const char* view_to_clone_name, index_t* line_selection, const char* comments, bool quality_column)
|
||||
{
|
||||
Obiview_p view;
|
||||
Obiview_p view_to_clone;
|
||||
@ -1207,7 +1218,7 @@ Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_
|
||||
view_to_clone = obi_open_view(dms, view_to_clone_name);
|
||||
if (view_to_clone == NULL)
|
||||
return NULL;
|
||||
view = obi_new_view_nuc_seqs(dms, view_name, view_to_clone, line_selection, comments);
|
||||
view = obi_new_view_nuc_seqs(dms, view_name, view_to_clone, line_selection, comments, quality_column);
|
||||
|
||||
obi_close_view(view_to_clone);
|
||||
|
||||
|
@ -183,6 +183,7 @@ Obiview_p obi_new_view_cloned_from_name(OBIDMS_p dms, const char* view_name, con
|
||||
* - NUC_SEQUENCE_COLUMN where nucleotide sequences are stored
|
||||
* - ID_COLUMN where sequence identifiers are stored
|
||||
* - DEFINITION_COLUMN where sequence definitions are stored
|
||||
* And, if quality_column is True:
|
||||
* - QUALITY_COLUMN where sequence qualities are stored
|
||||
*
|
||||
* @param dms A pointer on the OBIDMS.
|
||||
@ -191,6 +192,7 @@ Obiview_p obi_new_view_cloned_from_name(OBIDMS_p dms, const char* view_name, con
|
||||
* @param line_selection Eventually a pointer on a list of indexes corresponding to a line selection to use with the view to clone
|
||||
* if there is one. NULL if there is no line selection or no view to clone.
|
||||
* @param comments Eventually, comments to associate with the view. NULL if not.
|
||||
* @param quality_column Whether or not a sequence quality column is associated with the view.
|
||||
*
|
||||
* @returns A pointer to the newly created view structure.
|
||||
* @retval NULL if an error occurred.
|
||||
@ -198,7 +200,7 @@ Obiview_p obi_new_view_cloned_from_name(OBIDMS_p dms, const char* view_name, con
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p view_to_clone, index_t* line_selection, const char* comments);
|
||||
Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p view_to_clone, index_t* line_selection, const char* comments, bool quality_column);
|
||||
|
||||
|
||||
/**
|
||||
@ -215,6 +217,7 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
|
||||
* - NUC_SEQUENCE_COLUMN where nucleotide sequences are stored
|
||||
* - ID_COLUMN where sequence identifiers are stored
|
||||
* - DEFINITION_COLUMN where sequence definitions are stored
|
||||
* And, if quality_column is True:
|
||||
* - QUALITY_COLUMN where sequence qualities are stored
|
||||
*
|
||||
* @param dms A pointer on the OBIDMS.
|
||||
@ -223,6 +226,7 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
|
||||
* @param line_selection Eventually a pointer on a list of indexes corresponding to a line selection to use with the view to clone
|
||||
* if there is one. NULL if there is no line selection or no view to clone.
|
||||
* @param comments Eventually, comments to associate with the view. NULL if not.
|
||||
* @param quality_column Whether or not a sequence quality column is associated with the view.
|
||||
*
|
||||
* @returns A pointer to the newly created view structure.
|
||||
* @retval NULL if an error occurred.
|
||||
@ -230,7 +234,7 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_name, const char* view_to_clone_name, index_t* line_selection, const char* comments);
|
||||
Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_name, const char* view_to_clone_name, index_t* line_selection, const char* comments, bool quality_column);
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user