Commit 54efff36 by Celine Mercier

C build ref db: fixed 2 bugs when setting arrays: size of an element in

in bits not bytes and using view API instead of column API
parent 6acb2171
......@@ -352,11 +352,11 @@ int build_reference_db(const char* dms_name,
// Read alignment score
score = obi_get_float_with_elt_idx_and_col_p_in_view(matrix_with_lca_view, matrix_score_column, i, 0);
///////////////// Compute for first sequence \\\\\\\\\\\\\\\\\\\\\\\
///////////////// Compute for first sequence \\\\\\\\\\\\\\\\\\\\\\\ (TODO function)
// Read arrays
lca_taxid_array = (obiint_t*) obi_column_get_array(final_lca_taxid_a_column, idx1, &taxid_array_length);
score_array = (obifloat_t*) obi_column_get_array(final_score_a_column, idx1, &score_array_length);
lca_taxid_array = (obiint_t*) obi_get_array_with_col_p_in_view(o_view, final_lca_taxid_a_column, idx1, &taxid_array_length);
score_array = (obifloat_t*) obi_get_array_with_col_p_in_view(o_view, final_score_a_column, idx1, &score_array_length);
taxid_array_writable_length = taxid_array_length;
score_array_writable_length = score_array_length;
......@@ -371,12 +371,12 @@ int build_reference_db(const char* dms_name,
// If empty, add values
if (taxid_array_length == 0)
{
if (obi_column_set_array(final_lca_taxid_a_column, idx1, &taxid_lca, (uint8_t) obi_sizeof(OBI_INT), 1) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_lca_taxid_a_column, idx1, &taxid_lca, (uint8_t) (obi_sizeof(OBI_INT) * 8), 1) < 0)
{
obidebug(1, "\nError setting a LCA taxid array in a column when building a reference database");
return -1;
}
if (obi_column_set_array(final_score_a_column, idx1, &score, (uint8_t) obi_sizeof(OBI_FLOAT), 1) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_score_a_column, idx1, &score, (uint8_t) (obi_sizeof(OBI_FLOAT) * 8), 1) < 0)
{
obidebug(1, "\nError setting a score array in a column when building a reference database");
return -1;
......@@ -482,12 +482,12 @@ int build_reference_db(const char* dms_name,
// Write new arrays
if (modified)
{
if (obi_column_set_array(final_lca_taxid_a_column, idx1, lca_taxid_array_writable, (uint8_t) obi_sizeof(OBI_INT), taxid_array_writable_length) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_lca_taxid_a_column, idx1, lca_taxid_array_writable, (uint8_t) (obi_sizeof(OBI_INT) * 8), taxid_array_writable_length) < 0)
{
obidebug(1, "\nError setting a LCA taxid array in a column when building a reference database");
return -1;
}
if (obi_column_set_array(final_score_a_column, idx1, score_array_writable, (uint8_t) obi_sizeof(OBI_FLOAT), score_array_writable_length) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_score_a_column, idx1, score_array_writable, (uint8_t) (obi_sizeof(OBI_FLOAT) * 8), score_array_writable_length) < 0)
{
obidebug(1, "\nError setting a score array in a column when building a reference database");
return -1;
......@@ -495,11 +495,11 @@ int build_reference_db(const char* dms_name,
}
}
///////////////// Compute for second sequence \\\\\\\\\\\\\\\\\\\\\\\
///////////////// Compute for second sequence \\\\\\\\\\\\\\\\\\\\\\\ (TODO function)
// Read arrays
lca_taxid_array = (obiint_t*) obi_column_get_array(final_lca_taxid_a_column, idx2, &taxid_array_length);
score_array = (obifloat_t*) obi_column_get_array(final_score_a_column, idx2, &score_array_length);
lca_taxid_array = (obiint_t*) obi_get_array_with_col_p_in_view(o_view, final_lca_taxid_a_column, idx2, &taxid_array_length);
score_array = (obifloat_t*) obi_get_array_with_col_p_in_view(o_view, final_score_a_column, idx2, &score_array_length);
taxid_array_writable_length = taxid_array_length;
score_array_writable_length = score_array_length;
......@@ -514,12 +514,12 @@ int build_reference_db(const char* dms_name,
// If empty, add values
if (taxid_array_length == 0)
{
if (obi_column_set_array(final_lca_taxid_a_column, idx2, &taxid_lca, (uint8_t) obi_sizeof(OBI_INT), 1) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_lca_taxid_a_column, idx2, &taxid_lca, (uint8_t) (obi_sizeof(OBI_INT) * 8), 1) < 0)
{
obidebug(1, "\nError setting a LCA taxid array in a column when building a reference database");
return -1;
}
if (obi_column_set_array(final_score_a_column, idx2, &score, (uint8_t) obi_sizeof(OBI_FLOAT), 1) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_score_a_column, idx2, &score, (uint8_t) (obi_sizeof(OBI_FLOAT) * 8), 1) < 0)
{
obidebug(1, "\nError setting a score array in a column when building a reference database");
return -1;
......@@ -626,12 +626,12 @@ int build_reference_db(const char* dms_name,
// Copy arrays for modification (can't edit in place, as it is stored in indexer data file)
if (modified)
{
if (obi_column_set_array(final_lca_taxid_a_column, idx2, lca_taxid_array_writable, (uint8_t) obi_sizeof(OBI_INT), taxid_array_writable_length) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_lca_taxid_a_column, idx2, lca_taxid_array_writable, (uint8_t) (obi_sizeof(OBI_INT) * 8), taxid_array_writable_length) < 0)
{
obidebug(1, "\nError setting a LCA taxid array in a column when building a reference database");
return -1;
}
if (obi_column_set_array(final_score_a_column, idx2, score_array_writable, (uint8_t) obi_sizeof(OBI_FLOAT), score_array_writable_length) < 0)
if (obi_set_array_with_col_p_in_view(o_view, final_score_a_column, idx2, score_array_writable, (uint8_t) (obi_sizeof(OBI_FLOAT) * 8), score_array_writable_length) < 0)
{
obidebug(1, "\nError setting a score array in a column when building a reference database");
return -1;
......
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