C: build_ref_db: now adds a comment with the threshold used to build the
DB
This commit is contained in:
@ -29,6 +29,7 @@
|
|||||||
#include "obi_lcs.h"
|
#include "obi_lcs.h"
|
||||||
#include "obidms_taxonomy.h"
|
#include "obidms_taxonomy.h"
|
||||||
#include "obidmscolumn_array.h"
|
#include "obidmscolumn_array.h"
|
||||||
|
#include "libjson/json_utils.h"
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
|
#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];
|
obifloat_t score_array_writable[1000];
|
||||||
bool modified;
|
bool modified;
|
||||||
bool merged;
|
bool merged;
|
||||||
|
char threshold_str[5];
|
||||||
|
char* new_comments;
|
||||||
|
|
||||||
// Discuss keeping the matrix view or not
|
// Discuss keeping the matrix view or not
|
||||||
matrix_view_name = calloc((strlen(o_view_name)+strlen("_matrix")+1), sizeof(char));
|
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,
|
matrix_view_name,
|
||||||
"{}", // TODO proper comments?
|
"{}",
|
||||||
false, false,
|
false, false,
|
||||||
threshold, true, 0, true,
|
threshold, true, 0, true,
|
||||||
1) < 0)
|
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
|
// Close views and DMS
|
||||||
if (obi_save_and_close_view(refs_view) < 0)
|
if (obi_save_and_close_view(refs_view) < 0)
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define LCA_TAXID_COLUMN_NAME "LCA_TAXID"
|
#define LCA_TAXID_COLUMN_NAME "LCA_TAXID"
|
||||||
#define LCA_TAXID_ARRAY_COLUMN_NAME "LCA_TAXID"
|
#define LCA_TAXID_ARRAY_COLUMN_NAME "LCA_TAXID"
|
||||||
#define LCA_SCORE_ARRAY_COLUMN_NAME "LCA_SCORE"
|
#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 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 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 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.
|
* @param taxonomy_name The name of the taxonomy stored in the DMS.
|
||||||
|
Reference in New Issue
Block a user