Commit 04c9470f by Celine Mercier

Fixed and cleaned DNA_seq_indexer API

parent be05c889
......@@ -16,7 +16,8 @@
#include "obiblob.h"
#include "obiblob_indexer.h"
#include "obidms.h"
#include "obidebug.h"
#include "obitypes.h"
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
......@@ -91,16 +92,11 @@ index_t obi_index_dna_seq(Obi_indexer_p indexer, const char* value)
char* obi_retrieve_dna_seq(Obi_indexer_p indexer, index_t idx)
{
Obi_blob_p value_b;
char* seq;
// Get encoded value
value_b = obi_indexer_get(indexer, idx);
// Decode sequence
seq = obi_blob_to_seq(value_b);
free(value_b);
return seq;
// Return decoded sequence
return obi_blob_to_seq(value_b);
}
......@@ -33,7 +33,7 @@
int obi_column_set_obiseq_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx, char* value)
{
index_t idx;
index_t idx;
// Check that the line number is not greater than the maximum allowed
if (line_nb >= MAXIMUM_LINE_COUNT)
......@@ -96,10 +96,7 @@ int obi_column_set_obiseq_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p c
return -1;
}
if (obi_column_set_obiseq_with_elt_idx(column, line_nb, element_idx, value) < 0)
return -1;
return 0;
return obi_column_set_obiseq_with_elt_idx(column, line_nb, element_idx, value);
}
......@@ -146,8 +143,7 @@ int obi_column_set_obiseq_with_elt_name(OBIDMS_column_p column, index_t line_nb,
element_idx = obi_column_get_element_index_from_name(column, element_name);
if (element_idx == OBIIdx_NA)
return -1;
obi_column_set_obiseq_with_elt_idx(column, line_nb, element_idx, value);
return 0;
return obi_column_set_obiseq_with_elt_idx(column, line_nb, element_idx, value);
}
......@@ -157,8 +153,7 @@ int obi_column_set_obiseq_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
element_idx = obi_column_get_element_index_from_name(column, element_name);
if (element_idx == OBIIdx_NA)
return -1;
obi_column_set_obiseq_with_elt_idx_in_view(view, column, line_nb, element_idx, value);
return 0;
return obi_column_set_obiseq_with_elt_idx_in_view(view, column, line_nb, element_idx, value);
}
......
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