Commit 0ee728c4 by Celine Mercier

C: build_ref_db: now adds a comment with the threshold used to build the

DB
parent 7423baca
......@@ -29,6 +29,7 @@
#include "obi_lcs.h"
#include "obidms_taxonomy.h"
#include "obidmscolumn_array.h"
#include "libjson/json_utils.h"
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
......@@ -167,6 +168,8 @@ int build_reference_db(const char* dms_name,
obifloat_t score_array_writable[1000];
bool modified;
bool merged;
char threshold_str[5];
char* new_comments;
// Discuss keeping the matrix view or not
matrix_view_name = calloc((strlen(o_view_name)+strlen("_matrix")+1), sizeof(char));
......@@ -185,7 +188,7 @@ int build_reference_db(const char* dms_name,
"",
"",
matrix_view_name,
"{}", // TODO proper comments?
"{}",
false, false,
threshold, true, 0, true,
1) < 0)
......@@ -788,6 +791,24 @@ int build_reference_db(const char* dms_name,
}
}
// Add information about the threshold used to build the DB
snprintf(threshold_str, 5, "%f", threshold);
new_comments = obi_add_comment((o_view->infos)->comments, DB_THRESHOLD_KEY_IN_COMMENTS, threshold_str);
if (new_comments == NULL)
{
obidebug(1, "\nError adding a comment (db threshold) to a view, key: %s, value: %s", DB_THRESHOLD_KEY_IN_COMMENTS, threshold_str);
return -1;
}
if (obi_view_write_comments(o_view, new_comments) < 0)
{
obidebug(1, "\nError adding a comment (db threshold) to a view, key: %s, value: %s", DB_THRESHOLD_KEY_IN_COMMENTS, threshold_str);
return -1;
}
free(new_comments);
// Close views and DMS
if (obi_save_and_close_view(refs_view) < 0)
{
......
......@@ -21,6 +21,7 @@
#define LCA_TAXID_COLUMN_NAME "LCA_TAXID"
#define LCA_TAXID_ARRAY_COLUMN_NAME "LCA_TAXID"
#define LCA_SCORE_ARRAY_COLUMN_NAME "LCA_SCORE"
#define DB_THRESHOLD_KEY_IN_COMMENTS "ref_db_threshold"
/**
......@@ -28,6 +29,9 @@
*
* Note: The columns where the results are written are automatically named and created.
*
* Note: The threshold used to build the db is saved in the view's comments with the key
* defined by the DB_THRESHOLD_KEY_IN_COMMENTS macro.
*
* @param dms_name The name of the DMS.
* @param refs_view_name The name of the view containing the reference sequences annotated with their taxids.
* @param taxonomy_name The name of the taxonomy stored in the DMS.
......
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