Merge branch 'master' of git@git.metabarcoding.org:obitools/obitools3.git
This commit is contained in:
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -18,7 +18,6 @@ cdef class OBIDMS_column:
|
||||
cdef index_t nb_elements_per_line
|
||||
cdef list elements_names
|
||||
|
||||
cpdef update_pointer(self)
|
||||
cpdef list get_elements_names(self)
|
||||
cpdef str get_data_type(self)
|
||||
cpdef index_t get_nb_lines_used(self)
|
||||
@ -52,14 +51,19 @@ cdef class OBIView:
|
||||
cpdef add_column(self,
|
||||
str column_name,
|
||||
obiversion_t version_number=*,
|
||||
str alias=*,
|
||||
str type=*,
|
||||
index_t nb_lines=*,
|
||||
index_t nb_elements_per_line=*,
|
||||
list elements_names=*,
|
||||
str indexer_name=*,
|
||||
str associated_column_name=*,
|
||||
obiversion_t associated_column_version=*,
|
||||
str comments=*,
|
||||
bint create=*
|
||||
)
|
||||
cpdef change_column_alias(self, str current_alias, str new_alias)
|
||||
cpdef update_column_pointers(self)
|
||||
cpdef select_line(self, index_t line_nb)
|
||||
cpdef select_lines(self, list line_selection)
|
||||
cpdef save_and_close(self)
|
||||
|
@ -55,7 +55,7 @@ from ._obidmscolumn_seq cimport OBIDMS_column_seq, \
|
||||
|
||||
from .capi.obiview cimport Obiview_p, \
|
||||
Obiview_infos_p, \
|
||||
Column_reference_p, \
|
||||
Alias_column_pair_p, \
|
||||
obi_new_view_nuc_seqs, \
|
||||
obi_new_view, \
|
||||
obi_new_view_cloned_from_name, \
|
||||
@ -65,7 +65,7 @@ from .capi.obiview cimport Obiview_p, \
|
||||
obi_open_view, \
|
||||
obi_view_delete_column, \
|
||||
obi_view_add_column, \
|
||||
obi_view_get_column, \
|
||||
obi_view_create_column_alias, \
|
||||
obi_view_get_column, \
|
||||
obi_view_get_pointer_on_column_in_view, \
|
||||
obi_select_line, \
|
||||
@ -124,9 +124,6 @@ cdef class OBIDMS_column :
|
||||
for line_nb in range(lines_used):
|
||||
yield self.get_line(line_nb)
|
||||
|
||||
cpdef update_pointer(self):
|
||||
self.pointer = <OBIDMS_column_p*> obi_view_get_pointer_on_column_in_view(self.view.pointer, str2bytes(self.column_name))
|
||||
|
||||
cpdef list get_elements_names(self):
|
||||
return self.elements_names
|
||||
|
||||
@ -297,48 +294,42 @@ cdef class OBIView :
|
||||
for i in range(view.infos.column_count) :
|
||||
column_p = <OBIDMS_column_p> (view.columns)[i]
|
||||
header = (column_p).header
|
||||
col_name = bytes2str(header.name)
|
||||
col_name = bytes2str(view.infos.column_references[i].alias)
|
||||
subclass = OBIDMS_column.get_subclass_type(column_p)
|
||||
self.columns[col_name] = subclass(self, col_name)
|
||||
|
||||
|
||||
def __repr__(self) :
|
||||
cdef str s
|
||||
s = str(self.name) + ", " + str(self.comments) + ", " + str(self.pointer.infos.line_count) + " lines\n"
|
||||
s = str(self.name) + "\n" + str(self.comments) + "\n" + str(self.pointer.infos.line_count) + " lines\n"
|
||||
for column_name in self.columns :
|
||||
s = s + self.columns[column_name].__repr__() + '\n'
|
||||
s = s + column_name + ": " + self.columns[column_name].__repr__() + '\n'
|
||||
return s
|
||||
|
||||
|
||||
cpdef delete_column(self, str column_name) :
|
||||
|
||||
cdef int i
|
||||
cdef Obiview_p view_p
|
||||
cdef OBIDMS_column column
|
||||
cdef OBIDMS_column_p column_p
|
||||
cdef OBIDMS_column_header_p header
|
||||
cdef str column_n
|
||||
|
||||
view = self.pointer
|
||||
|
||||
if obi_view_delete_column(view_p, str2bytes(column_name)) < 0 :
|
||||
if obi_view_delete_column(self.pointer, str2bytes(column_name)) < 0 :
|
||||
raise Exception("Problem deleting a column from a view")
|
||||
|
||||
# Update the dictionaries of column pointers and column objects, and update pointers in column objects (make function?):
|
||||
# Update the dictionary of column objects:
|
||||
(self.columns).pop(column_name)
|
||||
|
||||
for column_n in self.columns :
|
||||
(self.columns[column_n]).update_pointer()
|
||||
self.update_column_pointers()
|
||||
|
||||
|
||||
cpdef add_column(self,
|
||||
str column_name,
|
||||
obiversion_t version_number=-1,
|
||||
str alias='',
|
||||
str type='',
|
||||
index_t nb_lines=0,
|
||||
index_t nb_elements_per_line=1,
|
||||
list elements_names=None,
|
||||
str indexer_name="",
|
||||
str associated_column_name="",
|
||||
obiversion_t associated_column_version=-1,
|
||||
str comments="",
|
||||
bint create=True
|
||||
) :
|
||||
@ -349,6 +340,11 @@ cdef class OBIView :
|
||||
cdef OBIDMS_column_p column_p
|
||||
|
||||
column_name_b = str2bytes(column_name)
|
||||
if alias == '' :
|
||||
alias = column_name
|
||||
alias_b = column_name_b
|
||||
else :
|
||||
alias_b = str2bytes(alias)
|
||||
|
||||
if nb_elements_per_line > 1 :
|
||||
elements_names_b = str2bytes(';'.join(elements_names))
|
||||
@ -373,18 +369,35 @@ cdef class OBIView :
|
||||
else :
|
||||
raise Exception("Invalid provided data type")
|
||||
|
||||
if (obi_view_add_column(self.pointer, column_name_b, version_number, # TODO should return pointer on column?
|
||||
if (obi_view_add_column(self.pointer, column_name_b, version_number, alias_b, # TODO should return pointer on column?
|
||||
data_type, nb_lines, nb_elements_per_line,
|
||||
elements_names_b, str2bytes(indexer_name),
|
||||
str2bytes(associated_column_name), associated_column_version,
|
||||
str2bytes(comments), create) < 0) :
|
||||
raise Exception("Problem adding a column in a view")
|
||||
|
||||
# Get the column pointer
|
||||
column_p = obi_view_get_column(self.pointer, column_name_b)
|
||||
column_p = obi_view_get_column(self.pointer, alias_b)
|
||||
|
||||
# Open and store the subclass
|
||||
subclass = OBIDMS_column.get_subclass_type(column_p)
|
||||
(self.columns)[column_name] = subclass(self, column_name)
|
||||
(self.columns)[alias] = subclass(self, alias)
|
||||
|
||||
|
||||
cpdef change_column_alias(self, str current_alias, str new_alias):
|
||||
if (obi_view_create_column_alias(self.pointer, str2bytes(current_alias), str2bytes(new_alias)) < 0) :
|
||||
raise Exception("Problem changing a column alias")
|
||||
# Update the dictionaries of column column objects
|
||||
self.columns[new_alias] = self.columns[current_alias]
|
||||
(self.columns).pop(current_alias)
|
||||
|
||||
|
||||
cpdef update_column_pointers(self):
|
||||
cdef str column_n
|
||||
cdef OBIDMS_column column
|
||||
for column_n in self.columns :
|
||||
column = self.columns[column_n]
|
||||
column.pointer = <OBIDMS_column_p*> obi_view_get_pointer_on_column_in_view(self.pointer, str2bytes(column_n))
|
||||
|
||||
|
||||
cpdef save_and_close(self) :
|
||||
@ -493,7 +506,7 @@ cdef class OBIView_NUC_SEQS(OBIView):
|
||||
for i in range(view.infos.column_count) :
|
||||
column_p = <OBIDMS_column_p> (view.columns)[i]
|
||||
header = (column_p).header
|
||||
col_name = bytes2str(header.name)
|
||||
col_name = bytes2str(view.infos.column_references[i].alias)
|
||||
subclass = OBIDMS_column.get_subclass_type(column_p)
|
||||
self.columns[col_name] = subclass(self, col_name)
|
||||
|
||||
@ -553,7 +566,7 @@ cdef class OBIView_line :
|
||||
(((self.view).columns)[column_name]).set_line(self.index, value)
|
||||
|
||||
def __contains__(self, str column_name):
|
||||
return (column_name in self.view)
|
||||
return (column_name in self.view.columns)
|
||||
|
||||
def __repr__(self):
|
||||
cdef dict line
|
||||
@ -623,7 +636,7 @@ cdef class OBIDMS :
|
||||
|
||||
cdef Obiview_infos_p view_infos_p
|
||||
cdef dict view_infos_d
|
||||
cdef Column_reference_p column_refs
|
||||
cdef Alias_column_pair_p column_refs
|
||||
cdef int i, j
|
||||
cdef str column_name
|
||||
|
||||
@ -643,11 +656,12 @@ cdef class OBIDMS :
|
||||
view_infos_d["line_selection"]["column_name"] = bytes2str((view_infos_p.line_selection).column_name)
|
||||
view_infos_d["line_selection"]["version"] = <int> (view_infos_p.line_selection).version
|
||||
view_infos_d["column_references"] = {}
|
||||
column_refs = view_infos_p.column_references
|
||||
column_references = view_infos_p.column_references
|
||||
for j in range(view_infos_d["column_count"]) :
|
||||
column_name = bytes2str((column_refs[j]).column_name)
|
||||
column_name = bytes2str((column_references[j]).alias)
|
||||
view_infos_d["column_references"][column_name] = {}
|
||||
view_infos_d["column_references"][column_name]["version"] = column_refs[j].version
|
||||
view_infos_d["column_references"][column_name]["original_name"] = bytes2str((column_references[j]).column_refs.column_name)
|
||||
view_infos_d["column_references"][column_name]["version"] = (column_references[j]).column_refs.version
|
||||
|
||||
obi_view_unmap_file(self.pointer, view_infos_p)
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -1,9 +1,9 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capi.obiview cimport obi_column_get_obibool_with_elt_name_in_view, \
|
||||
obi_column_get_obibool_with_elt_idx_in_view, \
|
||||
obi_column_set_obibool_with_elt_name_in_view, \
|
||||
obi_column_set_obibool_with_elt_idx_in_view
|
||||
from .capi.obiview cimport obi_get_bool_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_bool_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_bool_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_bool_with_elt_idx_and_col_p_in_view
|
||||
from .capi.obierrno cimport obi_errno
|
||||
from .capi.obitypes cimport OBIBool_NA, obibool_t
|
||||
|
||||
@ -17,7 +17,7 @@ cdef class OBIDMS_column_bool(OBIDMS_column):
|
||||
cpdef object get_line(self, index_t line_nb):
|
||||
cdef obibool_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obibool_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
value = obi_get_bool_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIBool_NA :
|
||||
@ -29,7 +29,7 @@ cdef class OBIDMS_column_bool(OBIDMS_column):
|
||||
cpdef set_line(self, index_t line_nb, object value):
|
||||
if value is None :
|
||||
value = OBIBool_NA
|
||||
if obi_column_set_obibool_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, <obibool_t> value) < 0:
|
||||
if obi_set_bool_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, <obibool_t> value) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ cdef class OBIDMS_column_multi_elts_bool(OBIDMS_column_multi_elts):
|
||||
cpdef object get_item(self, index_t line_nb, str element_name):
|
||||
cdef obibool_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obibool_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
value = obi_get_bool_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBIBool_NA :
|
||||
@ -56,7 +56,7 @@ cdef class OBIDMS_column_multi_elts_bool(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obibool_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
value = obi_get_bool_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIBool_NA :
|
||||
@ -73,5 +73,5 @@ cdef class OBIDMS_column_multi_elts_bool(OBIDMS_column_multi_elts):
|
||||
cpdef set_item(self, index_t line_nb, str element_name, object value):
|
||||
if value is None :
|
||||
value = OBIBool_NA
|
||||
if obi_column_set_obibool_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), <obibool_t> value) < 0:
|
||||
if obi_set_bool_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), <obibool_t> value) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -1,9 +1,9 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capi.obiview cimport obi_column_get_obichar_with_elt_name_in_view, \
|
||||
obi_column_get_obichar_with_elt_idx_in_view, \
|
||||
obi_column_set_obichar_with_elt_name_in_view, \
|
||||
obi_column_set_obichar_with_elt_idx_in_view
|
||||
from .capi.obiview cimport obi_get_char_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_char_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_char_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_char_with_elt_idx_and_col_p_in_view
|
||||
from .capi.obierrno cimport obi_errno
|
||||
from .capi.obitypes cimport OBIChar_NA, obichar_t
|
||||
|
||||
@ -15,7 +15,7 @@ cdef class OBIDMS_column_char(OBIDMS_column):
|
||||
cpdef object get_line(self, index_t line_nb):
|
||||
cdef obichar_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obichar_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
value = obi_get_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIChar_NA :
|
||||
@ -27,7 +27,7 @@ cdef class OBIDMS_column_char(OBIDMS_column):
|
||||
cpdef set_line(self, index_t line_nb, object value):
|
||||
if value is None :
|
||||
value = OBIChar_NA
|
||||
if obi_column_set_obichar_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)[0]) < 0:
|
||||
if obi_set_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)[0]) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ cdef class OBIDMS_column_multi_elts_char(OBIDMS_column_multi_elts):
|
||||
cpdef object get_item(self, index_t line_nb, str element_name):
|
||||
cdef obichar_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obichar_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
value = obi_get_char_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBIChar_NA :
|
||||
@ -54,7 +54,7 @@ cdef class OBIDMS_column_multi_elts_char(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obichar_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
value = obi_get_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIChar_NA :
|
||||
@ -71,6 +71,6 @@ cdef class OBIDMS_column_multi_elts_char(OBIDMS_column_multi_elts):
|
||||
cpdef set_item(self, index_t line_nb, str element_name, object value):
|
||||
if value is None :
|
||||
value = OBIChar_NA
|
||||
if obi_column_set_obichar_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), str2bytes(value)[0]) < 0:
|
||||
if obi_set_char_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), str2bytes(value)[0]) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -1,9 +1,9 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capi.obiview cimport obi_column_get_obifloat_with_elt_name_in_view, \
|
||||
obi_column_get_obifloat_with_elt_idx_in_view, \
|
||||
obi_column_set_obifloat_with_elt_name_in_view, \
|
||||
obi_column_set_obifloat_with_elt_idx_in_view
|
||||
from .capi.obiview cimport obi_get_float_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_float_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_float_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_float_with_elt_idx_and_col_p_in_view
|
||||
from .capi.obierrno cimport obi_errno
|
||||
from .capi.obitypes cimport OBIFloat_NA, obifloat_t
|
||||
|
||||
@ -15,7 +15,7 @@ cdef class OBIDMS_column_float(OBIDMS_column):
|
||||
cpdef object get_line(self, index_t line_nb):
|
||||
cdef obifloat_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obifloat_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
value = obi_get_float_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIFloat_NA :
|
||||
@ -27,7 +27,7 @@ cdef class OBIDMS_column_float(OBIDMS_column):
|
||||
cpdef set_line(self, index_t line_nb, object value):
|
||||
if value is None :
|
||||
value = OBIFloat_NA
|
||||
if obi_column_set_obifloat_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, <obifloat_t> value) < 0:
|
||||
if obi_set_float_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, <obifloat_t> value) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ cdef class OBIDMS_column_multi_elts_float(OBIDMS_column_multi_elts):
|
||||
cpdef object get_item(self, index_t line_nb, str element_name):
|
||||
cdef obifloat_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obifloat_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
value = obi_get_float_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBIFloat_NA :
|
||||
@ -54,7 +54,7 @@ cdef class OBIDMS_column_multi_elts_float(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obifloat_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
value = obi_get_float_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIFloat_NA :
|
||||
@ -71,6 +71,6 @@ cdef class OBIDMS_column_multi_elts_float(OBIDMS_column_multi_elts):
|
||||
cpdef set_item(self, index_t line_nb, str element_name, object value):
|
||||
if value is None :
|
||||
value = OBIFloat_NA
|
||||
if obi_column_set_obifloat_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), <obifloat_t> value) < 0:
|
||||
if obi_set_float_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), <obifloat_t> value) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -1,9 +1,9 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capi.obiview cimport obi_column_get_obiint_with_elt_name_in_view, \
|
||||
obi_column_get_obiint_with_elt_idx_in_view, \
|
||||
obi_column_set_obiint_with_elt_name_in_view, \
|
||||
obi_column_set_obiint_with_elt_idx_in_view
|
||||
from .capi.obiview cimport obi_get_int_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_int_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_int_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_int_with_elt_idx_and_col_p_in_view
|
||||
from .capi.obierrno cimport obi_errno
|
||||
from .capi.obitypes cimport OBIInt_NA, obiint_t
|
||||
|
||||
@ -17,7 +17,7 @@ cdef class OBIDMS_column_int(OBIDMS_column):
|
||||
cpdef object get_line(self, index_t line_nb):
|
||||
cdef obiint_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obiint_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
value = obi_get_int_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIInt_NA :
|
||||
@ -29,7 +29,7 @@ cdef class OBIDMS_column_int(OBIDMS_column):
|
||||
cpdef set_line(self, index_t line_nb, object value):
|
||||
if value is None :
|
||||
value = OBIInt_NA
|
||||
if obi_column_set_obiint_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, <obiint_t> value) < 0:
|
||||
if obi_set_int_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, <obiint_t> value) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ cdef class OBIDMS_column_multi_elts_int(OBIDMS_column_multi_elts):
|
||||
cpdef object get_item(self, index_t line_nb, str element_name):
|
||||
cdef obiint_t value
|
||||
cdef object result
|
||||
value = obi_column_get_obiint_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
value = obi_get_int_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBIInt_NA :
|
||||
@ -56,7 +56,7 @@ cdef class OBIDMS_column_multi_elts_int(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obiint_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
value = obi_get_int_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIInt_NA :
|
||||
@ -73,6 +73,6 @@ cdef class OBIDMS_column_multi_elts_int(OBIDMS_column_multi_elts):
|
||||
cpdef set_item(self, index_t line_nb, str element_name, object value):
|
||||
if value is None :
|
||||
value = OBIInt_NA
|
||||
if obi_column_set_obiint_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), <obiint_t> value) < 0:
|
||||
if obi_set_int_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), <obiint_t> value) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -1,13 +1,13 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capi.obiview cimport obi_column_get_obiqual_char_with_elt_name_in_view, \
|
||||
obi_column_get_obiqual_char_with_elt_idx_in_view, \
|
||||
obi_column_set_obiqual_char_with_elt_name_in_view, \
|
||||
obi_column_set_obiqual_char_with_elt_idx_in_view, \
|
||||
obi_column_get_obiqual_int_with_elt_name_in_view, \
|
||||
obi_column_get_obiqual_int_with_elt_idx_in_view, \
|
||||
obi_column_set_obiqual_int_with_elt_name_in_view, \
|
||||
obi_column_set_obiqual_int_with_elt_idx_in_view
|
||||
from .capi.obiview cimport obi_get_qual_char_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_qual_char_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_qual_char_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_qual_char_with_elt_idx_and_col_p_in_view, \
|
||||
obi_get_qual_int_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_qual_int_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_qual_int_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_qual_int_with_elt_idx_and_col_p_in_view
|
||||
|
||||
from .capi.obierrno cimport obi_errno
|
||||
from .capi.obitypes cimport OBIQual_char_NA, OBIQual_int_NA, const_char_p
|
||||
@ -29,7 +29,7 @@ cdef class OBIDMS_column_qual(OBIDMS_column):
|
||||
cdef int value_length
|
||||
cdef object result
|
||||
cdef int i
|
||||
value = obi_column_get_obiqual_int_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, &value_length)
|
||||
value = obi_get_qual_int_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, &value_length)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIQual_int_NA :
|
||||
@ -44,7 +44,7 @@ cdef class OBIDMS_column_qual(OBIDMS_column):
|
||||
cdef char* value
|
||||
cdef object result
|
||||
cdef int i
|
||||
value = obi_column_get_obiqual_char_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
value = obi_get_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIQual_char_NA :
|
||||
@ -58,23 +58,23 @@ cdef class OBIDMS_column_qual(OBIDMS_column):
|
||||
cdef uint8_t* value_b
|
||||
cdef int value_length
|
||||
if value is None :
|
||||
if obi_column_set_obiqual_int_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIQual_int_NA, 0) < 0:
|
||||
if obi_set_qual_int_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIQual_int_NA, 0) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
else :
|
||||
value_length = len(value)
|
||||
value_b = <uint8_t*> malloc(value_length * sizeof(uint8_t))
|
||||
for i in range(value_length) :
|
||||
value_b[i] = <uint8_t>value[i]
|
||||
if obi_column_set_obiqual_int_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, value_b, value_length) < 0:
|
||||
if obi_set_qual_int_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, value_b, value_length) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
free(value_b)
|
||||
|
||||
cpdef set_str_line(self, index_t line_nb, object value):
|
||||
if value is None :
|
||||
if obi_column_set_obiqual_char_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIQual_char_NA) < 0:
|
||||
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIQual_char_NA) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
else :
|
||||
if obi_column_set_obiqual_char_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0:
|
||||
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ cdef class OBIDMS_column_multi_elts_qual(OBIDMS_column_multi_elts):
|
||||
cdef int value_length
|
||||
cdef object result
|
||||
cdef int i
|
||||
value = obi_column_get_obiqual_int_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), &value_length)
|
||||
value = obi_get_qual_int_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), &value_length)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBIQual_int_NA :
|
||||
@ -99,7 +99,7 @@ cdef class OBIDMS_column_multi_elts_qual(OBIDMS_column_multi_elts):
|
||||
cpdef object get_str_item(self, index_t line_nb, str element_name):
|
||||
cdef char* value
|
||||
cdef object result
|
||||
value = obi_column_get_obiqual_char_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
value = obi_get_qual_char_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBIQual_char_NA :
|
||||
@ -120,7 +120,7 @@ cdef class OBIDMS_column_multi_elts_qual(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obiqual_int_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i, &value_length)
|
||||
value = obi_get_qual_int_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i, &value_length)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIQual_int_NA :
|
||||
@ -145,7 +145,7 @@ cdef class OBIDMS_column_multi_elts_qual(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obiqual_char_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
value = obi_get_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIQual_char_NA :
|
||||
@ -164,21 +164,21 @@ cdef class OBIDMS_column_multi_elts_qual(OBIDMS_column_multi_elts):
|
||||
cdef uint8_t* value_b
|
||||
cdef int value_length
|
||||
if value is None :
|
||||
if obi_column_set_obiqual_int_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), OBIQual_int_NA, 0) < 0:
|
||||
if obi_set_qual_int_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), OBIQual_int_NA, 0) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
else :
|
||||
value_length = len(value)
|
||||
value_b = <uint8_t*> malloc(value_length * sizeof(uint8_t))
|
||||
for i in range(value_length) :
|
||||
value_b[i] = <uint8_t>value[i]
|
||||
if obi_column_set_obiqual_int_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), value_b, value_length) < 0:
|
||||
if obi_set_qual_int_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), value_b, value_length) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
free(value_b)
|
||||
|
||||
cpdef set_str_item(self, index_t line_nb, str element_name, object value):
|
||||
if value is None :
|
||||
if obi_column_set_obiqual_char_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), OBIQual_char_NA) < 0:
|
||||
if obi_set_qual_char_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), OBIQual_char_NA) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
else :
|
||||
if obi_column_set_obiqual_char_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), str2bytes(value)) < 0:
|
||||
if obi_set_qual_char_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), str2bytes(value)) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -1,9 +1,9 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capi.obiview cimport obi_column_get_obiseq_with_elt_name_in_view, \
|
||||
obi_column_get_obiseq_with_elt_idx_in_view, \
|
||||
obi_column_set_obiseq_with_elt_name_in_view, \
|
||||
obi_column_set_obiseq_with_elt_idx_in_view
|
||||
from .capi.obiview cimport obi_get_seq_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_seq_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_seq_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_seq_with_elt_idx_and_col_p_in_view
|
||||
from .capi.obialign cimport obi_align_one_column
|
||||
from .capi.obierrno cimport obi_errno
|
||||
from .capi.obitypes cimport OBISeq_NA, const_char_p
|
||||
@ -20,7 +20,7 @@ cdef class OBIDMS_column_seq(OBIDMS_column):
|
||||
cpdef object get_line(self, index_t line_nb):
|
||||
cdef char* value
|
||||
cdef object result
|
||||
value = obi_column_get_obiseq_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
value = obi_get_seq_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBISeq_NA :
|
||||
@ -32,10 +32,10 @@ cdef class OBIDMS_column_seq(OBIDMS_column):
|
||||
|
||||
cpdef set_line(self, index_t line_nb, object value):
|
||||
if value is None :
|
||||
if obi_column_set_obiseq_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBISeq_NA) < 0:
|
||||
if obi_set_seq_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBISeq_NA) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
else :
|
||||
if obi_column_set_obiseq_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0:
|
||||
if obi_set_seq_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
# TODO choose alignment type (lcs or other) with supplementary argument
|
||||
@ -56,7 +56,7 @@ cdef class OBIDMS_column_multi_elts_seq(OBIDMS_column_multi_elts):
|
||||
cpdef object get_item(self, index_t line_nb, str element_name):
|
||||
cdef char* value
|
||||
cdef object result
|
||||
value = obi_column_get_obiseq_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
value = obi_get_seq_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBISeq_NA :
|
||||
@ -75,7 +75,7 @@ cdef class OBIDMS_column_multi_elts_seq(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obiseq_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
value = obi_get_seq_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBISeq_NA :
|
||||
@ -102,7 +102,7 @@ cdef class OBIDMS_column_multi_elts_seq(OBIDMS_column_multi_elts):
|
||||
else:
|
||||
raise TypeError('Sequence value must be of type Bytes, Str or None')
|
||||
|
||||
if obi_column_set_obiseq_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), value_b) < 0:
|
||||
if obi_set_seq_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), value_b) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
# cpdef align(self, ): # TODO
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -1,9 +1,9 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capi.obiview cimport obi_column_get_obistr_with_elt_name_in_view, \
|
||||
obi_column_get_obistr_with_elt_idx_in_view, \
|
||||
obi_column_set_obistr_with_elt_name_in_view, \
|
||||
obi_column_set_obistr_with_elt_idx_in_view
|
||||
from .capi.obiview cimport obi_get_str_with_elt_name_and_col_p_in_view, \
|
||||
obi_get_str_with_elt_idx_and_col_p_in_view, \
|
||||
obi_set_str_with_elt_name_and_col_p_in_view, \
|
||||
obi_set_str_with_elt_idx_and_col_p_in_view
|
||||
from .capi.obierrno cimport obi_errno
|
||||
from .capi.obitypes cimport OBIStr_NA, const_char_p
|
||||
|
||||
@ -15,7 +15,7 @@ cdef class OBIDMS_column_str(OBIDMS_column):
|
||||
cpdef object get_line(self, index_t line_nb):
|
||||
cdef const_char_p value
|
||||
cdef object result
|
||||
value = obi_column_get_obistr_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
value = obi_get_str_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIStr_NA :
|
||||
@ -27,10 +27,10 @@ cdef class OBIDMS_column_str(OBIDMS_column):
|
||||
|
||||
cpdef set_line(self, index_t line_nb, object value):
|
||||
if value is None :
|
||||
if obi_column_set_obistr_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIStr_NA) < 0:
|
||||
if obi_set_str_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIStr_NA) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
else :
|
||||
if obi_column_set_obistr_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0:
|
||||
if obi_set_str_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ cdef class OBIDMS_column_multi_elts_str(OBIDMS_column_multi_elts):
|
||||
cpdef object get_item(self, index_t line_nb, str element_name):
|
||||
cdef const_char_p value
|
||||
cdef object result
|
||||
value = obi_column_get_obistr_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
value = obi_get_str_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb, element_name)
|
||||
if value == OBIStr_NA :
|
||||
@ -58,7 +58,7 @@ cdef class OBIDMS_column_multi_elts_str(OBIDMS_column_multi_elts):
|
||||
result = {}
|
||||
all_NA = True
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_column_get_obistr_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
value = obi_get_str_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
|
||||
if obi_errno > 0 :
|
||||
raise IndexError(line_nb)
|
||||
if value == OBIStr_NA :
|
||||
@ -79,6 +79,6 @@ cdef class OBIDMS_column_multi_elts_str(OBIDMS_column_multi_elts):
|
||||
value_b = OBIStr_NA
|
||||
else :
|
||||
value_b = str2bytes(value)
|
||||
if obi_column_set_obistr_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), value_b) < 0:
|
||||
if obi_set_str_with_elt_name_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), value_b) < 0:
|
||||
raise Exception("Problem setting a value in a column")
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -8,6 +8,8 @@
|
||||
../../../src/dna_seq_indexer.c
|
||||
../../../src/encode.h
|
||||
../../../src/encode.c
|
||||
../../../src/hashtable.h
|
||||
../../../src/hashtable.c
|
||||
../../../src/murmurhash2.h
|
||||
../../../src/murmurhash2.c
|
||||
../../../src/obi_align.h
|
||||
|
@ -16,6 +16,12 @@ from libc.stdint cimport uint8_t
|
||||
|
||||
cdef extern from "obidmscolumn.h" nogil:
|
||||
|
||||
struct Column_reference_t :
|
||||
const_char_p column_name
|
||||
obiversion_t version
|
||||
|
||||
ctypedef Column_reference_t* Column_reference_p
|
||||
|
||||
struct OBIDMS_column_header_t:
|
||||
size_t header_size
|
||||
size_t data_size
|
||||
@ -30,6 +36,7 @@ cdef extern from "obidmscolumn.h" nogil:
|
||||
obiversion_t cloned_from
|
||||
const_char_p name
|
||||
const_char_p indexer_name
|
||||
Column_reference_t associated_column
|
||||
const_char_p comments
|
||||
|
||||
ctypedef OBIDMS_column_header_t* OBIDMS_column_header_p
|
||||
@ -48,6 +55,8 @@ cdef extern from "obidmscolumn.h" nogil:
|
||||
index_t nb_elements_per_line,
|
||||
const_char_p elements_names,
|
||||
const_char_p indexer_name,
|
||||
const_char_p associated_colum_name,
|
||||
obiversion_t associated_colum_version,
|
||||
const_char_p comments)
|
||||
|
||||
OBIDMS_column_p obi_open_column(OBIDMS_p dms,
|
||||
|
@ -10,7 +10,9 @@ from .obitypes cimport const_char_p, \
|
||||
index_t, \
|
||||
time_t
|
||||
from ..capi.obidms cimport OBIDMS_p
|
||||
from ..capi.obidmscolumn cimport OBIDMS_column_p
|
||||
from ..capi.obidmscolumn cimport OBIDMS_column_p, \
|
||||
Column_reference_t, \
|
||||
Column_reference_p
|
||||
|
||||
from libc.stdint cimport uint8_t
|
||||
|
||||
@ -24,11 +26,11 @@ cdef extern from "obiview.h" nogil:
|
||||
extern const_char_p QUALITY_COLUMN
|
||||
|
||||
|
||||
struct Column_reference_t :
|
||||
const_char_p column_name
|
||||
obiversion_t version
|
||||
struct Alias_column_pair_t :
|
||||
Column_reference_t column_refs
|
||||
const_char_p alias
|
||||
|
||||
ctypedef Column_reference_t* Column_reference_p
|
||||
ctypedef Alias_column_pair_t* Alias_column_pair_p
|
||||
|
||||
|
||||
struct Obiview_infos_t :
|
||||
@ -40,7 +42,7 @@ cdef extern from "obiview.h" nogil:
|
||||
Column_reference_t line_selection
|
||||
index_t line_count
|
||||
int column_count
|
||||
Column_reference_p column_references
|
||||
Alias_column_pair_p column_references
|
||||
const_char_p comments
|
||||
|
||||
ctypedef Obiview_infos_t* Obiview_infos_p
|
||||
@ -53,6 +55,8 @@ cdef extern from "obiview.h" nogil:
|
||||
OBIDMS_column_p line_selection
|
||||
OBIDMS_column_p new_line_selection
|
||||
OBIDMS_column_p columns
|
||||
int nb_predicates
|
||||
# TODO declarations for column dictionary and predicate function array?
|
||||
|
||||
ctypedef Obiview_t* Obiview_p
|
||||
|
||||
@ -74,11 +78,14 @@ cdef extern from "obiview.h" nogil:
|
||||
int obi_view_add_column(Obiview_p view,
|
||||
const_char_p column_name,
|
||||
obiversion_t version_number,
|
||||
const_char_p alias,
|
||||
OBIType_t data_type,
|
||||
index_t nb_lines,
|
||||
index_t nb_elements_per_line,
|
||||
const_char_p elements_names,
|
||||
const_char_p indexer_name,
|
||||
const_char_p associated_column_name,
|
||||
obiversion_t associated_column_version,
|
||||
const_char_p comments,
|
||||
bint create)
|
||||
|
||||
@ -92,189 +99,205 @@ cdef extern from "obiview.h" nogil:
|
||||
|
||||
OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const_char_p column_name)
|
||||
|
||||
int obi_view_create_column_alias(Obiview_p view, const_char_p current_name, const_char_p alias)
|
||||
|
||||
int obi_save_view(Obiview_p view)
|
||||
|
||||
int obi_close_view(Obiview_p view)
|
||||
|
||||
int obi_save_and_close_view(Obiview_p view)
|
||||
|
||||
int obi_column_set_obiint_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
|
||||
# OBI_INT
|
||||
int obi_set_int_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name,
|
||||
obiint_t value)
|
||||
|
||||
int obi_column_set_obiint_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_int_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
obiint_t value)
|
||||
|
||||
obiint_t obi_column_get_obiint_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obiint_t obi_get_int_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name)
|
||||
|
||||
obiint_t obi_column_get_obiint_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obiint_t obi_get_int_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx)
|
||||
|
||||
int obi_column_set_obibool_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
|
||||
# OBI_BOOL
|
||||
int obi_set_bool_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name,
|
||||
obibool_t value)
|
||||
|
||||
int obi_column_set_obibool_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_bool_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
obibool_t value)
|
||||
|
||||
obibool_t obi_column_get_obibool_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obibool_t obi_get_bool_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name)
|
||||
|
||||
obibool_t obi_column_get_obibool_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obibool_t obi_get_bool_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx)
|
||||
|
||||
int obi_column_set_obichar_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
|
||||
# OBI_CHAR
|
||||
int obi_set_char_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name,
|
||||
obichar_t value)
|
||||
|
||||
int obi_column_set_obichar_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_char_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
obichar_t value)
|
||||
|
||||
obichar_t obi_column_get_obichar_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obichar_t obi_get_char_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name)
|
||||
|
||||
obichar_t obi_column_get_obichar_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obichar_t obi_get_char_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx)
|
||||
|
||||
int obi_column_set_obifloat_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
|
||||
# OBI_FLOAT
|
||||
int obi_set_float_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name,
|
||||
obifloat_t value)
|
||||
|
||||
int obi_column_set_obifloat_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_float_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
obifloat_t value)
|
||||
|
||||
obifloat_t obi_column_get_obifloat_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obifloat_t obi_get_float_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name)
|
||||
|
||||
obifloat_t obi_column_get_obifloat_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
obifloat_t obi_get_float_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx)
|
||||
|
||||
int obi_column_set_obiqual_char_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
|
||||
# OBI_QUAL
|
||||
int obi_set_qual_char_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
const char* value)
|
||||
|
||||
int obi_column_set_obiqual_int_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_qual_int_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
const uint8_t* value,
|
||||
int value_length)
|
||||
|
||||
char* obi_column_get_obiqual_char_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
char* obi_get_qual_char_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx)
|
||||
|
||||
const uint8_t* obi_column_get_obiqual_int_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
const uint8_t* obi_get_qual_int_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
int* value_length)
|
||||
|
||||
int obi_column_set_obiqual_char_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_qual_char_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const char* element_name,
|
||||
const char* value)
|
||||
|
||||
int obi_column_set_obiqual_int_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_qual_int_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const char* element_name,
|
||||
const uint8_t* value,
|
||||
int value_length)
|
||||
|
||||
char* obi_column_get_obiqual_char_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
char* obi_get_qual_char_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const char* element_name)
|
||||
|
||||
const uint8_t* obi_column_get_obiqual_int_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
const uint8_t* obi_get_qual_int_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const char* element_name,
|
||||
int* value_length)
|
||||
|
||||
int obi_column_set_obistr_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
|
||||
# OBI_STR
|
||||
int obi_set_str_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name,
|
||||
const_char_p value)
|
||||
|
||||
int obi_column_set_obistr_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_str_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
const_char_p value)
|
||||
|
||||
const_char_p obi_column_get_obistr_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
const_char_p obi_get_str_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name)
|
||||
|
||||
const_char_p obi_column_get_obistr_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
const_char_p obi_get_str_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx)
|
||||
|
||||
int obi_column_set_obiseq_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
|
||||
# OBI_SEQ
|
||||
int obi_set_seq_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name,
|
||||
const_char_p value)
|
||||
|
||||
int obi_column_set_obiseq_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
int obi_set_seq_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx,
|
||||
const_char_p value)
|
||||
|
||||
char* obi_column_get_obiseq_with_elt_name_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
char* obi_get_seq_with_elt_name_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
const_char_p element_name)
|
||||
|
||||
char* obi_column_get_obiseq_with_elt_idx_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column,
|
||||
char* obi_get_seq_with_elt_idx_and_col_p_in_view(Obiview_p view,
|
||||
OBIDMS_column_p column_p,
|
||||
index_t line_nb,
|
||||
index_t element_idx)
|
||||
|
||||
|
197
src/hashtable.c
Normal file
197
src/hashtable.c
Normal file
@ -0,0 +1,197 @@
|
||||
/****************************************************************************
|
||||
* Hash table source file *
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file hashtable.c
|
||||
* @author Celine Mercier
|
||||
* @date July 26th 2016
|
||||
* @brief Source file for hash table functions.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "string.h"
|
||||
|
||||
#include "murmurhash2.h"
|
||||
#include "hashtable.h"
|
||||
|
||||
|
||||
// Create a new hashtable
|
||||
hashtable_p ht_create(size_t size)
|
||||
{
|
||||
hashtable_p hashtable = NULL;
|
||||
size_t i;
|
||||
|
||||
// Allocate the table
|
||||
hashtable = malloc(sizeof(hashtable_t));
|
||||
if (hashtable == NULL)
|
||||
return NULL;
|
||||
|
||||
// Allocate the head nodes
|
||||
hashtable->table = malloc(size * sizeof(entry_p));
|
||||
if (hashtable->table == NULL)
|
||||
return NULL;
|
||||
|
||||
// Initialize the head nodes
|
||||
for (i=0; i<size; i++)
|
||||
hashtable->table[i] = NULL;
|
||||
|
||||
hashtable->size = size;
|
||||
|
||||
return hashtable;
|
||||
}
|
||||
|
||||
|
||||
// Create an entry
|
||||
entry_p ht_new_entry(const char* key, void* value)
|
||||
{
|
||||
entry_p new_entry;
|
||||
|
||||
new_entry = malloc(sizeof(entry_t));
|
||||
if (new_entry == NULL)
|
||||
return NULL;
|
||||
|
||||
new_entry->key = strdup(key);
|
||||
if (new_entry->key == NULL)
|
||||
return NULL;
|
||||
|
||||
new_entry->value = value;
|
||||
|
||||
new_entry->next = NULL;
|
||||
|
||||
return new_entry;
|
||||
}
|
||||
|
||||
|
||||
// Delete an entry
|
||||
int ht_delete_entry(hashtable_p hashtable, const char* key)
|
||||
{
|
||||
entry_p last = NULL;
|
||||
entry_p entry = NULL;
|
||||
size_t bin = 0;
|
||||
|
||||
bin = murmurhash2(key, strlen(key), SEED);
|
||||
bin = bin % hashtable->size;
|
||||
|
||||
// Step through the bin looking for the value
|
||||
entry = hashtable->table[bin];
|
||||
|
||||
while ((entry != NULL) && (strcmp(key, entry->key ) != 0))
|
||||
{
|
||||
last = entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
|
||||
if (entry == NULL) // key not found
|
||||
return -1;
|
||||
|
||||
// Link the entries before and after the entry
|
||||
if (last != NULL) // If not head node
|
||||
last->next = entry->next;
|
||||
else // If head node
|
||||
hashtable->table[bin] = entry->next;
|
||||
|
||||
// Free the entry
|
||||
free(entry->key);
|
||||
free(entry->value);
|
||||
free(entry);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Set a new entry in the hash table. If the key is already in the table, the value is replaced by the new one
|
||||
int ht_set(hashtable_p hashtable, const char* key, void* value)
|
||||
{
|
||||
size_t bin = 0;
|
||||
entry_p new_entry = NULL;
|
||||
entry_p next = NULL;
|
||||
entry_p last = NULL;
|
||||
|
||||
if ((key == NULL) || (value == NULL))
|
||||
return -1;
|
||||
|
||||
bin = murmurhash2(key, strlen(key), SEED);
|
||||
bin = bin % hashtable->size;
|
||||
|
||||
next = hashtable->table[bin];
|
||||
|
||||
while ((next != NULL) && (strcmp(key, next->key) != 0))
|
||||
{
|
||||
last = next;
|
||||
next = next->next;
|
||||
}
|
||||
|
||||
// If the key is already in the table, the value is replaced
|
||||
if ((next != NULL) && (strcmp(key, next->key) == 0))
|
||||
new_entry->value = value;
|
||||
|
||||
// Else, create the new entry and link it at the end of the list
|
||||
else
|
||||
{
|
||||
// Create the new entry
|
||||
new_entry = ht_new_entry(key, value);
|
||||
if (new_entry == NULL)
|
||||
return -1;
|
||||
|
||||
// If it is the first entry of that bin, we're at the head node of the list, and we replace it with the new entry
|
||||
if (last == NULL)
|
||||
hashtable->table[bin] = new_entry;
|
||||
|
||||
// Else link the new entry at the end of the list
|
||||
else
|
||||
last->next = new_entry;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Retrieve a value from a hash table
|
||||
void* ht_get(hashtable_p hashtable, const char* key)
|
||||
{
|
||||
size_t bin = 0;
|
||||
entry_p entry;
|
||||
|
||||
bin = murmurhash2(key, strlen(key), SEED);
|
||||
bin = bin % hashtable->size;
|
||||
|
||||
// Step through the bin looking for the value
|
||||
entry = hashtable->table[bin];
|
||||
|
||||
while ((entry != NULL) && (strcmp(key, entry->key ) != 0))
|
||||
entry = entry->next;
|
||||
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
|
||||
else
|
||||
return entry->value;
|
||||
}
|
||||
|
||||
|
||||
// Free the hash table
|
||||
void ht_free(hashtable_p hashtable)
|
||||
{
|
||||
size_t i;
|
||||
entry_p entry;
|
||||
entry_p next;
|
||||
|
||||
for (i=0; i < hashtable->size; i++)
|
||||
{
|
||||
next = hashtable->table[i];
|
||||
while (next != NULL)
|
||||
{
|
||||
entry = next;
|
||||
free(entry->key);
|
||||
next = entry->next;
|
||||
free(entry);
|
||||
}
|
||||
}
|
||||
free(hashtable->table);
|
||||
free(hashtable);
|
||||
}
|
||||
|
||||
|
123
src/hashtable.h
Normal file
123
src/hashtable.h
Normal file
@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
* Hash table header file *
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file hashtable.h
|
||||
* @author Celine Mercier
|
||||
* @date July 26th 2016
|
||||
* @brief Header file for hash table functions.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HASHTABLE_H_
|
||||
#define HASHTABLE_H_
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define SEED (0x9747b28c) /**< The seed used by the hash function.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Structure for an entry.
|
||||
*/
|
||||
typedef struct entry_s {
|
||||
char* key; /**< Key used to refer to the entry.
|
||||
*/
|
||||
void* value; /**< Pointer on the value to be stored.
|
||||
*/
|
||||
struct entry_s* next; /**< Pointer on the next entry in the bin.
|
||||
*/
|
||||
} entry_t, *entry_p;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Structure for a hash table.
|
||||
*/
|
||||
typedef struct hashtable {
|
||||
size_t size; /**< Number of bins in the table.
|
||||
*/
|
||||
entry_p* table; /**< Table of bins.
|
||||
*/
|
||||
} hashtable_t, *hashtable_p;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Creates a new hashtable.
|
||||
*
|
||||
* @param size The number of bins in the hash table.
|
||||
*
|
||||
* @returns A pointer to the newly created hash table.
|
||||
* @retval NULL if an error occurred.
|
||||
*
|
||||
* @since July 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
hashtable_p ht_create(size_t size);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Inserts a new entry in the hash table.
|
||||
* If the key is already in the table, the value is replaced by the new one.
|
||||
*
|
||||
* @param hashtable A pointer on the hash table structure.
|
||||
* @param key The key.
|
||||
* @param value A pointer on the value associated with the key.
|
||||
*
|
||||
* @retval 0 if the entry was correctly set.
|
||||
* @retval -1 if an error occurred.
|
||||
*
|
||||
* @since July 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int ht_set(hashtable_p hashtable, const char* key, void* value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Retrieves a value from a hash table.
|
||||
*
|
||||
* @param hashtable A pointer on the hash table structure.
|
||||
* @param key The key.
|
||||
*
|
||||
* @returns A pointer on the value associated with the key.
|
||||
* @retval NULL if the key was not found.
|
||||
*
|
||||
* @since July 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
void* ht_get(hashtable_p hashtable, const char* key);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Deletes an entry.
|
||||
*
|
||||
* @param hashtable A pointer on the hash table structure.
|
||||
* @param key The key.
|
||||
*
|
||||
* @retval 0 if the entry was correctly deleted.
|
||||
* @retval -1 if an error occurred.
|
||||
*
|
||||
* @since July 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int ht_delete_entry(hashtable_p hashtable, const char* key);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Frees a hash table.
|
||||
*
|
||||
* @param hashtable A pointer on the hash table structure.
|
||||
*
|
||||
* @since July 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
void ht_free(hashtable_p hashtable);
|
||||
|
||||
|
||||
#endif /* HASHTABLE_H_ */
|
||||
|
@ -534,6 +534,8 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
index_t nb_elements_per_line,
|
||||
const char* elements_names,
|
||||
const char* indexer_name,
|
||||
const char* associated_column_name,
|
||||
obiversion_t associated_column_version,
|
||||
const char* comments
|
||||
)
|
||||
{
|
||||
@ -750,6 +752,30 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
if (comments != NULL)
|
||||
strncpy(header->comments, comments, COMMENTS_MAX_LENGTH);
|
||||
|
||||
// Store the associated column reference if needed // TODO discuss cases
|
||||
if (data_type == OBI_QUAL)
|
||||
{
|
||||
if (associated_column_name == NULL)
|
||||
{
|
||||
obidebug(1, "\nError: The name of the associated column when creating a new column is NULL");
|
||||
munmap(new_column->header, header_size);
|
||||
close(column_file_descriptor);
|
||||
free(new_column);
|
||||
return NULL;
|
||||
}
|
||||
strcpy((header->associated_column).column_name, associated_column_name);
|
||||
|
||||
if (associated_column_version == -1)
|
||||
{
|
||||
obidebug(1, "\nError: The version of the associated column when creating a new column is not defined");
|
||||
munmap(new_column->header, header_size);
|
||||
close(column_file_descriptor);
|
||||
free(new_column);
|
||||
return NULL;
|
||||
}
|
||||
(header->associated_column).version = associated_column_version;
|
||||
}
|
||||
|
||||
// If the data type is OBI_STR, OBI_SEQ or OBI_QUAL, the associated obi_indexer is opened or created
|
||||
if ((returned_data_type == OBI_STR) || (returned_data_type == OBI_SEQ) || (returned_data_type == OBI_QUAL))
|
||||
{
|
||||
@ -964,6 +990,8 @@ OBIDMS_column_p obi_clone_column(OBIDMS_p dms,
|
||||
nb_elements_per_line,
|
||||
(column_to_clone->header)->elements_names,
|
||||
(column_to_clone->header)->indexer_name,
|
||||
((column_to_clone->header)->associated_column).column_name,
|
||||
((column_to_clone->header)->associated_column).version,
|
||||
(column_to_clone->header)->comments
|
||||
);
|
||||
|
||||
|
@ -38,6 +38,17 @@
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Structure referencing a column by its name and its version.
|
||||
*/
|
||||
typedef struct Column_reference {
|
||||
char column_name[OBIDMS_COLUMN_MAX_NAME+1]; /**< Name of the column.
|
||||
*/
|
||||
obiversion_t version; /**< Version of the column.
|
||||
*/
|
||||
} Column_reference_t, *Column_reference_p;
|
||||
|
||||
|
||||
/**
|
||||
* @brief OBIDMS column header structure.
|
||||
*/
|
||||
@ -73,6 +84,8 @@ typedef struct OBIDMS_column_header {
|
||||
*/
|
||||
char indexer_name[INDEXER_MAX_NAME+1]; /**< If there is one, the indexer name as a NULL terminated string.
|
||||
*/
|
||||
Column_reference_t associated_column; /**< If there is one, the reference to the associated column.
|
||||
*/
|
||||
char comments[COMMENTS_MAX_LENGTH+1]; /**< Comments stored as a classical zero end C string.
|
||||
*/
|
||||
} OBIDMS_column_header_t, *OBIDMS_column_header_p;
|
||||
@ -168,13 +181,15 @@ size_t obi_get_platform_header_size();
|
||||
* @param nb_elements_per_line The number of elements per line. // TODO talk about default values
|
||||
* @param elements_names The names of the elements with ';' as separator.
|
||||
* @param indexer_name The name of the indexer if there is one associated with the column.
|
||||
* @param associated_column_name The name of the associated column if there is one.
|
||||
* @param associated_column_version The version of the associated column if there is one.
|
||||
* @param comments Optional comments associated with the column.
|
||||
*
|
||||
* @returns A pointer on the newly created column structure.
|
||||
* @retval NULL if an error occurred.
|
||||
*
|
||||
* @since May 2015
|
||||
* @author Eric Coissac (eric.coissac@metabarcoding.org)
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
const char* column_name,
|
||||
@ -183,6 +198,8 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
index_t nb_elements_per_line,
|
||||
const char* elements_names,
|
||||
const char* indexer_name,
|
||||
const char* associated_column_name,
|
||||
obiversion_t associated_column_version,
|
||||
const char* comments
|
||||
);
|
||||
|
||||
|
1189
src/obiview.c
1189
src/obiview.c
File diff suppressed because it is too large
Load Diff
302
src/obiview.h
302
src/obiview.h
@ -25,6 +25,7 @@
|
||||
#include "obidms.h"
|
||||
#include "obidmscolumn.h"
|
||||
#include "obierrno.h"
|
||||
#include "hashtable.h"
|
||||
|
||||
|
||||
#define OBIVIEW_NAME_MAX_LENGTH (1000) /**< The maximum length of an OBIDMS view name.
|
||||
@ -55,14 +56,15 @@
|
||||
|
||||
|
||||
/**
|
||||
* @brief Structure referencing a column by its name and its version.
|
||||
* @brief Structure for column aliases.
|
||||
* Column aliases are alternative names used to identify a column in the context of a view.
|
||||
*/
|
||||
typedef struct Column_reference {
|
||||
char column_name[OBIDMS_COLUMN_MAX_NAME+1]; /**< Name of the column.
|
||||
typedef struct Alias_column_pair {
|
||||
Column_reference_t column_refs; /**< References (name and version) of the column.
|
||||
*/
|
||||
obiversion_t version; /**< Version of the column.
|
||||
char alias[OBIDMS_COLUMN_MAX_NAME+1]; /**< Alias of the column in the context of a view.
|
||||
*/
|
||||
} Column_reference_t, *Column_reference_p;
|
||||
} Alias_column_pair_t, *Alias_column_pair_p;
|
||||
|
||||
|
||||
/**
|
||||
@ -82,13 +84,13 @@ typedef struct Obiview_infos {
|
||||
*/
|
||||
bool all_lines; /**< Whether there is a line selection associated with the view.
|
||||
*/
|
||||
Column_reference_t line_selection; /**< Whether there is a line selection associated with the view.
|
||||
Column_reference_t line_selection; /**< The references of the line selection associated with the view if there is one.
|
||||
*/
|
||||
index_t line_count; /**< The number of lines in the view.
|
||||
*/
|
||||
int column_count; /**< The number of columns in the view.
|
||||
*/
|
||||
Column_reference_t column_references[MAX_NB_OPENED_COLUMNS]; /**< References (name and version) for all the columns in the view.
|
||||
Alias_column_pair_t column_references[MAX_NB_OPENED_COLUMNS]; /**< References (name, version and alias) for all the columns in the view.
|
||||
*/
|
||||
char comments[OBIVIEW_COMMENTS_MAX_LENGTH+1]; /**< Comments, additional informations on the view.
|
||||
*/
|
||||
@ -117,33 +119,16 @@ typedef struct Obiview {
|
||||
*/
|
||||
OBIDMS_column_p columns[MAX_NB_OPENED_COLUMNS]; /**< Array of pointers on all the columns of the view.
|
||||
*/
|
||||
hashtable_p column_dict; /**< Hash table storing the pairs of column names or aliases with the associated
|
||||
* column pointers.
|
||||
*/
|
||||
int nb_predicates; /**< Number of predicates to test when closing the view.
|
||||
*/
|
||||
char* (**predicate_functions)(struct Obiview* view); /**< Array of pointers on all predicate functions to test when closing the view.
|
||||
*/
|
||||
} Obiview_t, *Obiview_p;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Structure for the header of view files.
|
||||
*/
|
||||
typedef struct Obiviews_header {
|
||||
size_t header_size; /**< Size of the header in bytes.
|
||||
*/
|
||||
size_t views_size; /**< Size of the views in bytes.
|
||||
*/
|
||||
int view_count; /**< Number of views saved.
|
||||
*/
|
||||
} Obiviews_header_t, *Obiviews_header_p;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Structure for the information stored in view files.
|
||||
*/
|
||||
typedef struct Obiviews_infos_all {
|
||||
Obiviews_header_p header; /**< Pointer on the header of the view file.
|
||||
*/
|
||||
Obiview_infos_p view_infos; /**< Pointer on the beginning (first view) of the informations on views.
|
||||
*/
|
||||
} Obiviews_infos_all_t, *Obiviews_infos_all_p;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Creates a new view.
|
||||
*
|
||||
@ -306,6 +291,7 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name);
|
||||
* @param view A pointer on the view.
|
||||
* @param column_name The name of the column.
|
||||
* @param version_number The version of the column if it should be opened and not created (if -1, the latest version is retrieved).
|
||||
* @param alias The unique name used to identify the column in the context of this view.
|
||||
* @param data_type The OBIType code of the data.
|
||||
* @param nb_lines The number of lines to be stored.
|
||||
* @param nb_elements_per_line The number of elements per line.
|
||||
@ -324,11 +310,14 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name);
|
||||
int obi_view_add_column(Obiview_p view,
|
||||
const char* column_name,
|
||||
obiversion_t version_number,
|
||||
const char* alias,
|
||||
OBIType_t data_type,
|
||||
index_t nb_lines,
|
||||
index_t nb_elements_per_line,
|
||||
const char* elements_names,
|
||||
const char* indexer_name,
|
||||
const char* associated_column_name,
|
||||
obiversion_t associated_column_version,
|
||||
const char* comments,
|
||||
bool create);
|
||||
|
||||
@ -383,6 +372,27 @@ OBIDMS_column_p obi_view_get_column(Obiview_p view, const char* column_name);
|
||||
OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const char* column_name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Changes the name that identifies a column in the context of a view.
|
||||
*
|
||||
* In the context of a view, each column is identified by a name that is unique in this view.
|
||||
*
|
||||
* @warning The view must be writable.
|
||||
*
|
||||
* @param view A pointer on the view.
|
||||
* @param current_name The current name that identifies the column in this view.
|
||||
* @param alias The new name that should be used to identify the column in this view.
|
||||
*
|
||||
* @returns A value indicating the success of the operation.
|
||||
* @retval 0 if the operation was successfully completed.
|
||||
* @retval -1 if an error occurred.
|
||||
*
|
||||
* @since July 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_view_create_column_alias(Obiview_p view, const char* current_name, const char* alias);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Selects a line in the context of a view.
|
||||
*
|
||||
@ -479,38 +489,6 @@ int obi_close_view(Obiview_p view);
|
||||
int obi_save_and_close_view(Obiview_p view);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Opens the structure containing all the informations written in the view file.
|
||||
*
|
||||
* @param dms A pointer on the OBIDMS to which the view file belongs.
|
||||
*
|
||||
* @returns A pointer on the view informations structure.
|
||||
* @retval NULL if an error occurred.
|
||||
*
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
Obiviews_infos_all_p obi_read_view_infos(OBIDMS_p dms);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Closes the structure containing all the informations written in the view file.
|
||||
*
|
||||
* @param views A pointer on the view informations structure.
|
||||
*
|
||||
* @returns A value indicating the success of the operation.
|
||||
* @retval 0 if the operation was successfully completed.
|
||||
* @retval -1 if an error occurred.
|
||||
*
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_close_view_infos(Obiviews_infos_all_p views);
|
||||
|
||||
|
||||
// TODO in following functions would it be better to use column names instead of column pointers?
|
||||
// check if it would be a gain or loss of time
|
||||
|
||||
/**
|
||||
* @brief Sets a value in an OBIDMS column containing data with the type OBI_BOOL, using the index of the element in the line,
|
||||
* in the context of a view.
|
||||
@ -518,7 +496,7 @@ int obi_close_view_infos(Obiviews_infos_all_p views);
|
||||
* Note: If the column is read-only or if there is a line selection associated with the view (making columns non-writable), it is cloned.
|
||||
*
|
||||
* @param view A pointer on the opened writable view.
|
||||
* @param column A pointer on the column.
|
||||
* @param column_p A pointer on the column.
|
||||
* @param line_nb The number of the line where the value should be set.
|
||||
* @param element_idx The index of the element that should be set in the line.
|
||||
* @param value The value that should be set.
|
||||
@ -530,14 +508,17 @@ int obi_close_view_infos(Obiviews_infos_all_p views);
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obibool_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, obibool_t value);
|
||||
int obi_set_bool_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, obibool_t value);
|
||||
|
||||
// TODO
|
||||
int obi_set_bool_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, obibool_t value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Recovers a value in an OBIDMS column containing data with the type OBI_BOOL, in the context of a view.
|
||||
*
|
||||
* @param view A pointer on the opened view.
|
||||
* @param column A pointer on the column.
|
||||
* @param column_p A pointer on the column.
|
||||
* @param line_nb The number of the line where the value should be recovered.
|
||||
* @param element_idx The index of the element that should be recovered in the line.
|
||||
*
|
||||
@ -547,7 +528,10 @@ int obi_column_set_obibool_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obibool_t obi_column_get_obibool_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
obibool_t obi_get_bool_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
// TODO
|
||||
obibool_t obi_get_bool_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -555,7 +539,7 @@ obibool_t obi_column_get_obibool_with_elt_idx_in_view(Obiview_p view, OBIDMS_col
|
||||
* using the name of the element in the line, in the context of a view.
|
||||
*
|
||||
* @param view A pointer on the opened writable view.
|
||||
* @param column A pointer on the column.
|
||||
* @param column_p A pointer on the column.
|
||||
* @param line_nb The number of the line where the value should be set.
|
||||
* @param element_name The name of the element that should be set in the line.
|
||||
* @param value The value that should be set.
|
||||
@ -567,7 +551,11 @@ obibool_t obi_column_get_obibool_with_elt_idx_in_view(Obiview_p view, OBIDMS_col
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obibool_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, obibool_t value);
|
||||
int obi_set_bool_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, obibool_t value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_bool_with_elt_name_and_column_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, obibool_t value);
|
||||
|
||||
|
||||
/**
|
||||
@ -575,7 +563,7 @@ int obi_column_set_obibool_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* using the name of the element in the line, in the context of a view.
|
||||
*
|
||||
* @param view A pointer on the opened view.
|
||||
* @param column A pointer on the column.
|
||||
* @param column_p A pointer on the column.
|
||||
* @param line_nb The number of the line where the value should be recovered.
|
||||
* @param element_name The name of the element that should be recovered in the line.
|
||||
*
|
||||
@ -585,7 +573,11 @@ int obi_column_set_obibool_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obibool_t obi_column_get_obibool_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
obibool_t obi_get_bool_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
obibool_t obi_get_bool_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
/**
|
||||
@ -607,7 +599,11 @@ obibool_t obi_column_get_obibool_with_elt_name_in_view(Obiview_p view, OBIDMS_co
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obichar_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, obichar_t value);
|
||||
int obi_set_char_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, obichar_t value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_char_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, obichar_t value);
|
||||
|
||||
|
||||
/**
|
||||
@ -624,7 +620,11 @@ int obi_column_set_obichar_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obichar_t obi_column_get_obichar_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
obichar_t obi_get_char_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
// TODO
|
||||
obichar_t obi_get_char_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -644,7 +644,11 @@ obichar_t obi_column_get_obichar_with_elt_idx_in_view(Obiview_p view, OBIDMS_col
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obichar_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, obichar_t value);
|
||||
int obi_set_char_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, obichar_t value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_char_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, obichar_t value);
|
||||
|
||||
|
||||
/**
|
||||
@ -662,7 +666,11 @@ int obi_column_set_obichar_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obichar_t obi_column_get_obichar_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
obichar_t obi_get_char_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
obichar_t obi_get_char_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
/**
|
||||
@ -684,7 +692,11 @@ obichar_t obi_column_get_obichar_with_elt_name_in_view(Obiview_p view, OBIDMS_co
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obifloat_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, obifloat_t value);
|
||||
int obi_set_float_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, obifloat_t value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_float_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, obifloat_t value);
|
||||
|
||||
|
||||
/**
|
||||
@ -701,7 +713,11 @@ int obi_column_set_obifloat_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obifloat_t obi_column_get_obifloat_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
obifloat_t obi_get_float_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
// TODO
|
||||
obifloat_t obi_get_float_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -721,7 +737,11 @@ obifloat_t obi_column_get_obifloat_with_elt_idx_in_view(Obiview_p view, OBIDMS_c
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obifloat_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, obifloat_t value);
|
||||
int obi_set_float_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, obifloat_t value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_float_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, obifloat_t value);
|
||||
|
||||
|
||||
/**
|
||||
@ -739,7 +759,11 @@ int obi_column_set_obifloat_with_elt_name_in_view(Obiview_p view, OBIDMS_column_
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obifloat_t obi_column_get_obifloat_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
obifloat_t obi_get_float_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
obifloat_t obi_get_float_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
/**
|
||||
@ -761,7 +785,11 @@ obifloat_t obi_column_get_obifloat_with_elt_name_in_view(Obiview_p view, OBIDMS_
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiint_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, obiint_t value);
|
||||
int obi_set_int_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, obiint_t value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_int_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, obiint_t value);
|
||||
|
||||
|
||||
/**
|
||||
@ -778,7 +806,11 @@ int obi_column_set_obiint_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p c
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obiint_t obi_column_get_obiint_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
obiint_t obi_get_int_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
// TODO
|
||||
obiint_t obi_get_int_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -798,7 +830,11 @@ obiint_t obi_column_get_obiint_with_elt_idx_in_view(Obiview_p view, OBIDMS_colum
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiint_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, obiint_t value);
|
||||
int obi_set_int_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, obiint_t value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_int_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, obiint_t value);
|
||||
|
||||
|
||||
/**
|
||||
@ -816,7 +852,11 @@ int obi_column_set_obiint_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
obiint_t obi_column_get_obiint_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
obiint_t obi_get_int_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
obiint_t obi_get_int_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
/**
|
||||
@ -841,7 +881,11 @@ obiint_t obi_column_get_obiint_with_elt_name_in_view(Obiview_p view, OBIDMS_colu
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiqual_char_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, const char* value);
|
||||
int obi_set_qual_char_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, const char* value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_qual_char_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, const char* value);
|
||||
|
||||
|
||||
/**
|
||||
@ -867,7 +911,11 @@ int obi_column_set_obiqual_char_with_elt_idx_in_view(Obiview_p view, OBIDMS_colu
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiqual_int_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, const uint8_t* value, int value_length);
|
||||
int obi_set_qual_int_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, const uint8_t* value, int value_length);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_qual_int_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, const uint8_t* value, int value_length);
|
||||
|
||||
|
||||
/**
|
||||
@ -888,7 +936,11 @@ int obi_column_set_obiqual_int_with_elt_idx_in_view(Obiview_p view, OBIDMS_colum
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
char* obi_column_get_obiqual_char_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
char* obi_get_qual_char_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
// TODO
|
||||
char* obi_get_qual_char_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -910,7 +962,11 @@ char* obi_column_get_obiqual_char_with_elt_idx_in_view(Obiview_p view, OBIDMS_co
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
const uint8_t* obi_column_get_obiqual_int_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, int* value_length);
|
||||
const uint8_t* obi_get_qual_int_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, int* value_length);
|
||||
|
||||
|
||||
// TODO
|
||||
const uint8_t* obi_get_qual_int_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, int* value_length);
|
||||
|
||||
|
||||
/**
|
||||
@ -935,7 +991,11 @@ const uint8_t* obi_column_get_obiqual_int_with_elt_idx_in_view(Obiview_p view, O
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiqual_char_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, const char* value);
|
||||
int obi_set_qual_char_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, const char* value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_qual_char_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, const char* value);
|
||||
|
||||
|
||||
/**
|
||||
@ -961,7 +1021,11 @@ int obi_column_set_obiqual_char_with_elt_name_in_view(Obiview_p view, OBIDMS_col
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiqual_int_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, const uint8_t* value, int value_length);
|
||||
int obi_set_qual_int_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, const uint8_t* value, int value_length);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_qual_int_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, const uint8_t* value, int value_length);
|
||||
|
||||
|
||||
/**
|
||||
@ -982,7 +1046,11 @@ int obi_column_set_obiqual_int_with_elt_name_in_view(Obiview_p view, OBIDMS_colu
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
char* obi_column_get_obiqual_char_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
char* obi_get_qual_char_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
char* obi_get_qual_char_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
/**
|
||||
@ -1004,7 +1072,11 @@ char* obi_column_get_obiqual_char_with_elt_name_in_view(Obiview_p view, OBIDMS_c
|
||||
* @since May 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
const uint8_t* obi_column_get_obiqual_int_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, int* value_length);
|
||||
const uint8_t* obi_get_qual_int_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, int* value_length);
|
||||
|
||||
|
||||
// TODO
|
||||
const uint8_t* obi_get_qual_int_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, int* value_length);
|
||||
|
||||
|
||||
/**
|
||||
@ -1026,7 +1098,11 @@ const uint8_t* obi_column_get_obiqual_int_with_elt_name_in_view(Obiview_p view,
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiseq_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, const char* value);
|
||||
int obi_set_seq_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, const char* value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_seq_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, const char* value);
|
||||
|
||||
|
||||
/**
|
||||
@ -1043,7 +1119,11 @@ int obi_column_set_obiseq_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p c
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
char* obi_column_get_obiseq_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
char* obi_get_seq_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
// TODO
|
||||
char* obi_get_seq_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -1063,7 +1143,11 @@ char* obi_column_get_obiseq_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obiseq_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, const char* value);
|
||||
int obi_set_seq_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, const char* value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_seq_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, const char* value);
|
||||
|
||||
|
||||
/**
|
||||
@ -1081,7 +1165,11 @@ int obi_column_set_obiseq_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
char* obi_column_get_obiseq_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
char* obi_get_seq_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
char* obi_get_seq_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
/**
|
||||
@ -1103,7 +1191,11 @@ char* obi_column_get_obiseq_with_elt_name_in_view(Obiview_p view, OBIDMS_column_
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obistr_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, const char* value);
|
||||
int obi_set_str_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, const char* value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_str_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, const char* value);
|
||||
|
||||
|
||||
/**
|
||||
@ -1120,7 +1212,11 @@ int obi_column_set_obistr_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p c
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
const char* obi_column_get_obistr_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
const char* obi_get_str_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
// TODO
|
||||
const char* obi_get_str_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -1140,7 +1236,11 @@ const char* obi_column_get_obistr_with_elt_idx_in_view(Obiview_p view, OBIDMS_co
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_set_obistr_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, const char* value);
|
||||
int obi_set_str_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, const char* value);
|
||||
|
||||
|
||||
// TODO
|
||||
int obi_set_str_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, const char* value);
|
||||
|
||||
|
||||
/**
|
||||
@ -1158,7 +1258,11 @@ int obi_column_set_obistr_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
|
||||
* @since February 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
const char* obi_column_get_obistr_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
const char* obi_get_str_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
const char* obi_get_str_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
#endif /* OBIVIEW_H_ */
|
||||
|
Reference in New Issue
Block a user