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,58 +294,57 @@ 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
|
||||
) :
|
||||
|
||||
cdef bytes column_name_b
|
||||
cdef bytes elements_names_b
|
||||
cdef object subclass
|
||||
cdef bytes column_name_b
|
||||
cdef bytes elements_names_b
|
||||
cdef object subclass
|
||||
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))
|
||||
@ -372,20 +368,37 @@ cdef class OBIView :
|
||||
data_type = OBI_SEQ
|
||||
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) :
|
||||
if (obi_save_and_close_view(self.pointer) < 0) :
|
||||
@ -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,21 +16,28 @@ 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
|
||||
index_t line_count
|
||||
index_t lines_used
|
||||
index_t nb_elements_per_line
|
||||
const_char_p elements_names
|
||||
OBIType_t returned_data_type
|
||||
OBIType_t stored_data_type
|
||||
time_t creation_date
|
||||
obiversion_t version
|
||||
obiversion_t cloned_from
|
||||
const_char_p name
|
||||
const_char_p indexer_name
|
||||
const_char_p comments
|
||||
size_t header_size
|
||||
size_t data_size
|
||||
index_t line_count
|
||||
index_t lines_used
|
||||
index_t nb_elements_per_line
|
||||
const_char_p elements_names
|
||||
OBIType_t returned_data_type
|
||||
OBIType_t stored_data_type
|
||||
time_t creation_date
|
||||
obiversion_t version
|
||||
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,7 +55,9 @@ 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)
|
||||
|
||||
|
Reference in New Issue
Block a user