DNA_seq_indexer API
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
#include "obitypes.h"
|
||||
#include "obierrno.h"
|
||||
#include "obidebug.h"
|
||||
#include "obiblob_indexer.h"
|
||||
#include "dna_seq_indexer.h"
|
||||
|
||||
|
||||
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
|
||||
@ -33,7 +33,6 @@
|
||||
|
||||
int obi_column_set_obiseq_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx, char* value)
|
||||
{
|
||||
Obi_blob_p value_b;
|
||||
index_t idx;
|
||||
|
||||
// Check that the line number is not greater than the maximum allowed
|
||||
@ -56,21 +55,13 @@ int obi_column_set_obiseq_with_elt_idx(OBIDMS_column_p column, index_t line_nb,
|
||||
if ((line_nb+1) > (column->header)->lines_used)
|
||||
(column->header)->lines_used = line_nb+1;
|
||||
|
||||
// Encode the value on a byte array with a header // TODO make function
|
||||
value_b = obi_seq_to_blob(value);
|
||||
if (value_b == NULL)
|
||||
return -1;
|
||||
|
||||
// Add in the indexer
|
||||
idx = obi_indexer_add(column->indexer, value_b);
|
||||
idx = obi_index_dna_seq(column->indexer, value);
|
||||
if (idx == -1)
|
||||
return -1;
|
||||
|
||||
// Add the value's index in the column
|
||||
*(((index_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = idx;
|
||||
|
||||
free(value_b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -114,8 +105,7 @@ int obi_column_set_obiseq_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p c
|
||||
|
||||
const char* obi_column_get_obiseq_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx)
|
||||
{
|
||||
index_t idx;
|
||||
Obi_blob_p value_b;
|
||||
index_t idx;
|
||||
|
||||
if ((line_nb+1) > ((column->header)->line_count))
|
||||
{
|
||||
@ -130,9 +120,7 @@ const char* obi_column_get_obiseq_with_elt_idx(OBIDMS_column_p column, index_t l
|
||||
if (idx == OBIIdx_NA)
|
||||
return OBISeq_NA;
|
||||
|
||||
value_b = obi_indexer_get(column->indexer, idx);
|
||||
|
||||
return obi_blob_to_seq(value_b);
|
||||
return obi_retrieve_dna_seq(column->indexer, idx);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user