First version for the association of one column to another. Closes #55
This commit is contained in:
@ -582,7 +582,11 @@ bool view_check_quality_matches_seq_column(Obiview_p view) // TODO Print error i
|
||||
if (qual_column == NULL)
|
||||
return false;
|
||||
|
||||
seq_column = obi_view_get_column(view, NUC_SEQUENCE_COLUMN); // TODO Get associated nuc column
|
||||
seq_column = obi_view_get_column(view, ((qual_column->header)->associated_column).column_name);
|
||||
//seq_column = obi_open_column(view->dms, ((qual_column->header)->associated_column).column_name, ((qual_column->header)->associated_column).version);
|
||||
// TODO discuss the fact that it's opened outside of the context of the view or not
|
||||
// TODO if outside of view, make function that opens a column from a column reference structure?
|
||||
|
||||
if (seq_column == NULL)
|
||||
return false;
|
||||
|
||||
@ -608,6 +612,9 @@ bool view_check_quality_matches_seq_column(Obiview_p view) // TODO Print error i
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//obi_close_column(seq_column);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -714,7 +721,7 @@ Obiview_p obi_new_view(OBIDMS_p dms, const char* view_name, Obiview_p view_to_cl
|
||||
// If there is a new line selection, build it by combining it with the one from the view to clone if there is one
|
||||
else if (line_selection != NULL)
|
||||
{
|
||||
view->line_selection = obi_create_column(view->dms, LINES_COLUMN_NAME, OBI_IDX, 0, 1, LINES_COLUMN_NAME, NULL, NULL);
|
||||
view->line_selection = obi_create_column(view->dms, LINES_COLUMN_NAME, OBI_IDX, 0, 1, LINES_COLUMN_NAME, NULL, NULL, -1, NULL);
|
||||
if ((view->line_selection) == NULL)
|
||||
{
|
||||
obidebug(1, "\nError creating a column corresponding to a line selection");
|
||||
@ -836,7 +843,8 @@ 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 view;
|
||||
Obiview_p view;
|
||||
OBIDMS_column_p associated_nuc_column;
|
||||
|
||||
if (view_to_clone != NULL)
|
||||
{ // Check that the view to clone is already a NUC_SEQS view (TODO discuss possibility of transforming type of a view)
|
||||
@ -857,25 +865,26 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
|
||||
if (view_to_clone == NULL)
|
||||
{
|
||||
// Adding sequence column
|
||||
if (obi_view_add_column(view, NUC_SEQUENCE_COLUMN, -1, OBI_SEQ, 0, 1, NUC_SEQUENCE_COLUMN, "", "Nucleotide sequences", true) < 0)
|
||||
if (obi_view_add_column(view, NUC_SEQUENCE_COLUMN, -1, OBI_SEQ, 0, 1, NUC_SEQUENCE_COLUMN, "", NULL, -1, "Nucleotide sequences", true) < 0)
|
||||
{
|
||||
obidebug(1, "Error adding an obligatory column in a nucleotide sequences view");
|
||||
return NULL;
|
||||
}
|
||||
// Adding id column
|
||||
if (obi_view_add_column(view, ID_COLUMN, -1, OBI_STR, 0, 1, ID_COLUMN, "", "Ids", true) < 0)
|
||||
if (obi_view_add_column(view, ID_COLUMN, -1, OBI_STR, 0, 1, ID_COLUMN, "", NULL, -1, "Ids", true) < 0)
|
||||
{
|
||||
obidebug(1, "Error adding an obligatory column in a nucleotide sequences view");
|
||||
return NULL;
|
||||
}
|
||||
// Adding definition column
|
||||
if (obi_view_add_column(view, DEFINITION_COLUMN, -1, OBI_STR, 0, 1, DEFINITION_COLUMN, "", "Definitions", true) < 0)
|
||||
if (obi_view_add_column(view, DEFINITION_COLUMN, -1, OBI_STR, 0, 1, DEFINITION_COLUMN, "", NULL, -1, "Definitions", true) < 0)
|
||||
{
|
||||
obidebug(1, "Error adding an obligatory column in a nucleotide sequences view");
|
||||
return NULL;
|
||||
}
|
||||
// Adding quality column
|
||||
if (obi_view_add_column(view, QUALITY_COLUMN, -1, OBI_QUAL, 0, 1, QUALITY_COLUMN, "", "Sequence qualities", true) < 0)
|
||||
associated_nuc_column = obi_view_get_column(view, NUC_SEQUENCE_COLUMN);
|
||||
if (obi_view_add_column(view, QUALITY_COLUMN, -1, 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;
|
||||
@ -1062,6 +1071,8 @@ int obi_view_add_column(Obiview_p view,
|
||||
index_t nb_elements_per_line,
|
||||
const char* elements_names,
|
||||
const char* indexer_name,
|
||||
const char* associated_column_name,
|
||||
obiversion_t associated_column_version,
|
||||
const char* comments,
|
||||
bool create) // all infos for creation or open
|
||||
{
|
||||
@ -1131,7 +1142,7 @@ int obi_view_add_column(Obiview_p view,
|
||||
// Open or create the column
|
||||
if (create)
|
||||
{ // Create column
|
||||
column = obi_create_column(view->dms, column_name, data_type, nb_lines, nb_elements_per_line, elements_names, indexer_name, comments);
|
||||
column = obi_create_column(view->dms, column_name, data_type, nb_lines, nb_elements_per_line, elements_names, indexer_name, associated_column_name, associated_column_version, comments);
|
||||
}
|
||||
else
|
||||
{ // Open column
|
||||
@ -1241,7 +1252,7 @@ int obi_select_line(Obiview_p view, index_t line_nb)
|
||||
// If the column for line selection doesn't already exists, create it and store its informations
|
||||
if ((view->new_line_selection) == NULL)
|
||||
{
|
||||
view->new_line_selection = obi_create_column(view->dms, LINES_COLUMN_NAME, OBI_IDX, 0, 1, LINES_COLUMN_NAME, NULL, NULL);
|
||||
view->new_line_selection = obi_create_column(view->dms, LINES_COLUMN_NAME, OBI_IDX, 0, 1, LINES_COLUMN_NAME, NULL, NULL, -1, NULL);
|
||||
if ((view->new_line_selection) == NULL)
|
||||
{
|
||||
obidebug(1, "\nError creating a column corresponding to a line selection");
|
||||
@ -1276,7 +1287,7 @@ int obi_select_lines(Obiview_p view, index_t* line_nbs)
|
||||
// If column for line selection doesn't already exists, create it and store its informations
|
||||
if ((view->new_line_selection) == NULL)
|
||||
{
|
||||
view->new_line_selection = obi_create_column(view->dms, LINES_COLUMN_NAME, OBI_IDX, 0, 1, LINES_COLUMN_NAME, NULL, NULL);
|
||||
view->new_line_selection = obi_create_column(view->dms, LINES_COLUMN_NAME, OBI_IDX, 0, 1, LINES_COLUMN_NAME, NULL, NULL, -1, NULL);
|
||||
if ((view->new_line_selection) == NULL)
|
||||
{
|
||||
obidebug(1, "\nError creating a column corresponding to a line selection");
|
||||
|
Reference in New Issue
Block a user