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

DB
This commit is contained in:
Celine Mercier
2019-08-31 18:29:40 +02:00
parent 7423bacac0
commit 0ee728c4d0
2 changed files with 26 additions and 1 deletions

View File

@ -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)
{