temporary remove some files
This commit is contained in:
@ -1,65 +0,0 @@
|
|||||||
../../../src/bloom.h
|
|
||||||
../../../src/bloom.c
|
|
||||||
../../../src/char_str_indexer.h
|
|
||||||
../../../src/char_str_indexer.c
|
|
||||||
../../../src/crc64.h
|
|
||||||
../../../src/crc64.c
|
|
||||||
../../../src/dna_seq_indexer.h
|
|
||||||
../../../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
|
|
||||||
../../../src/obi_align.c
|
|
||||||
../../../src/obiavl.h
|
|
||||||
../../../src/obiavl.c
|
|
||||||
../../../src/obiblob_indexer.h
|
|
||||||
../../../src/obiblob_indexer.c
|
|
||||||
../../../src/obiblob.h
|
|
||||||
../../../src/obiblob.c
|
|
||||||
../../../src/obidebug.h
|
|
||||||
../../../src/obidms_taxonomy.h
|
|
||||||
../../../src/obidms_taxonomy.c
|
|
||||||
../../../src/obidms.h
|
|
||||||
../../../src/obidms.c
|
|
||||||
../../../src/obidmscolumn_blob.c
|
|
||||||
../../../src/obidmscolumn_blob.h
|
|
||||||
../../../src/obidmscolumn_bool.c
|
|
||||||
../../../src/obidmscolumn_bool.h
|
|
||||||
../../../src/obidmscolumn_char.c
|
|
||||||
../../../src/obidmscolumn_char.h
|
|
||||||
../../../src/obidmscolumn_float.c
|
|
||||||
../../../src/obidmscolumn_float.h
|
|
||||||
../../../src/obidmscolumn_idx.h
|
|
||||||
../../../src/obidmscolumn_idx.c
|
|
||||||
../../../src/obidmscolumn_int.c
|
|
||||||
../../../src/obidmscolumn_int.h
|
|
||||||
../../../src/obidmscolumn_qual.h
|
|
||||||
../../../src/obidmscolumn_qual.c
|
|
||||||
../../../src/obidmscolumn_seq.c
|
|
||||||
../../../src/obidmscolumn_seq.h
|
|
||||||
../../../src/obidmscolumn_str.c
|
|
||||||
../../../src/obidmscolumn_str.h
|
|
||||||
../../../src/obidmscolumn.h
|
|
||||||
../../../src/obidmscolumn.c
|
|
||||||
../../../src/obidmscolumndir.h
|
|
||||||
../../../src/obidmscolumndir.c
|
|
||||||
../../../src/obierrno.h
|
|
||||||
../../../src/obierrno.c
|
|
||||||
../../../src/obilittlebigman.h
|
|
||||||
../../../src/obilittlebigman.c
|
|
||||||
../../../src/obitypes.h
|
|
||||||
../../../src/obitypes.c
|
|
||||||
../../../src/obiview.h
|
|
||||||
../../../src/obiview.c
|
|
||||||
../../../src/sse_banded_LCS_alignment.h
|
|
||||||
../../../src/sse_banded_LCS_alignment.c
|
|
||||||
../../../src/uint8_indexer.h
|
|
||||||
../../../src/uint8_indexer.c
|
|
||||||
../../../src/upperband.h
|
|
||||||
../../../src/upperband.c
|
|
||||||
../../../src/utils.h
|
|
||||||
../../../src/utils.c
|
|
@ -1,65 +0,0 @@
|
|||||||
../../../src/bloom.h
|
|
||||||
../../../src/bloom.c
|
|
||||||
../../../src/char_str_indexer.h
|
|
||||||
../../../src/char_str_indexer.c
|
|
||||||
../../../src/crc64.h
|
|
||||||
../../../src/crc64.c
|
|
||||||
../../../src/dna_seq_indexer.h
|
|
||||||
../../../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
|
|
||||||
../../../src/obi_align.c
|
|
||||||
../../../src/obiavl.h
|
|
||||||
../../../src/obiavl.c
|
|
||||||
../../../src/obiblob_indexer.h
|
|
||||||
../../../src/obiblob_indexer.c
|
|
||||||
../../../src/obiblob.h
|
|
||||||
../../../src/obiblob.c
|
|
||||||
../../../src/obidebug.h
|
|
||||||
../../../src/obidms_taxonomy.h
|
|
||||||
../../../src/obidms_taxonomy.c
|
|
||||||
../../../src/obidms.h
|
|
||||||
../../../src/obidms.c
|
|
||||||
../../../src/obidmscolumn_blob.c
|
|
||||||
../../../src/obidmscolumn_blob.h
|
|
||||||
../../../src/obidmscolumn_bool.c
|
|
||||||
../../../src/obidmscolumn_bool.h
|
|
||||||
../../../src/obidmscolumn_char.c
|
|
||||||
../../../src/obidmscolumn_char.h
|
|
||||||
../../../src/obidmscolumn_float.c
|
|
||||||
../../../src/obidmscolumn_float.h
|
|
||||||
../../../src/obidmscolumn_idx.h
|
|
||||||
../../../src/obidmscolumn_idx.c
|
|
||||||
../../../src/obidmscolumn_int.c
|
|
||||||
../../../src/obidmscolumn_int.h
|
|
||||||
../../../src/obidmscolumn_qual.h
|
|
||||||
../../../src/obidmscolumn_qual.c
|
|
||||||
../../../src/obidmscolumn_seq.c
|
|
||||||
../../../src/obidmscolumn_seq.h
|
|
||||||
../../../src/obidmscolumn_str.c
|
|
||||||
../../../src/obidmscolumn_str.h
|
|
||||||
../../../src/obidmscolumn.h
|
|
||||||
../../../src/obidmscolumn.c
|
|
||||||
../../../src/obidmscolumndir.h
|
|
||||||
../../../src/obidmscolumndir.c
|
|
||||||
../../../src/obierrno.h
|
|
||||||
../../../src/obierrno.c
|
|
||||||
../../../src/obilittlebigman.h
|
|
||||||
../../../src/obilittlebigman.c
|
|
||||||
../../../src/obitypes.h
|
|
||||||
../../../src/obitypes.c
|
|
||||||
../../../src/obiview.h
|
|
||||||
../../../src/obiview.c
|
|
||||||
../../../src/sse_banded_LCS_alignment.h
|
|
||||||
../../../src/sse_banded_LCS_alignment.c
|
|
||||||
../../../src/uint8_indexer.h
|
|
||||||
../../../src/uint8_indexer.c
|
|
||||||
../../../src/upperband.h
|
|
||||||
../../../src/upperband.c
|
|
||||||
../../../src/utils.h
|
|
||||||
../../../src/utils.c
|
|
@ -1,65 +0,0 @@
|
|||||||
../../../src/bloom.h
|
|
||||||
../../../src/bloom.c
|
|
||||||
../../../src/char_str_indexer.h
|
|
||||||
../../../src/char_str_indexer.c
|
|
||||||
../../../src/crc64.h
|
|
||||||
../../../src/crc64.c
|
|
||||||
../../../src/dna_seq_indexer.h
|
|
||||||
../../../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
|
|
||||||
../../../src/obi_align.c
|
|
||||||
../../../src/obiavl.h
|
|
||||||
../../../src/obiavl.c
|
|
||||||
../../../src/obiblob_indexer.h
|
|
||||||
../../../src/obiblob_indexer.c
|
|
||||||
../../../src/obiblob.h
|
|
||||||
../../../src/obiblob.c
|
|
||||||
../../../src/obidebug.h
|
|
||||||
../../../src/obidms_taxonomy.h
|
|
||||||
../../../src/obidms_taxonomy.c
|
|
||||||
../../../src/obidms.h
|
|
||||||
../../../src/obidms.c
|
|
||||||
../../../src/obidmscolumn_blob.c
|
|
||||||
../../../src/obidmscolumn_blob.h
|
|
||||||
../../../src/obidmscolumn_bool.c
|
|
||||||
../../../src/obidmscolumn_bool.h
|
|
||||||
../../../src/obidmscolumn_char.c
|
|
||||||
../../../src/obidmscolumn_char.h
|
|
||||||
../../../src/obidmscolumn_float.c
|
|
||||||
../../../src/obidmscolumn_float.h
|
|
||||||
../../../src/obidmscolumn_idx.h
|
|
||||||
../../../src/obidmscolumn_idx.c
|
|
||||||
../../../src/obidmscolumn_int.c
|
|
||||||
../../../src/obidmscolumn_int.h
|
|
||||||
../../../src/obidmscolumn_qual.h
|
|
||||||
../../../src/obidmscolumn_qual.c
|
|
||||||
../../../src/obidmscolumn_seq.c
|
|
||||||
../../../src/obidmscolumn_seq.h
|
|
||||||
../../../src/obidmscolumn_str.c
|
|
||||||
../../../src/obidmscolumn_str.h
|
|
||||||
../../../src/obidmscolumn.h
|
|
||||||
../../../src/obidmscolumn.c
|
|
||||||
../../../src/obidmscolumndir.h
|
|
||||||
../../../src/obidmscolumndir.c
|
|
||||||
../../../src/obierrno.h
|
|
||||||
../../../src/obierrno.c
|
|
||||||
../../../src/obilittlebigman.h
|
|
||||||
../../../src/obilittlebigman.c
|
|
||||||
../../../src/obitypes.h
|
|
||||||
../../../src/obitypes.c
|
|
||||||
../../../src/obiview.h
|
|
||||||
../../../src/obiview.c
|
|
||||||
../../../src/sse_banded_LCS_alignment.h
|
|
||||||
../../../src/sse_banded_LCS_alignment.c
|
|
||||||
../../../src/uint8_indexer.h
|
|
||||||
../../../src/uint8_indexer.c
|
|
||||||
../../../src/upperband.h
|
|
||||||
../../../src/upperband.c
|
|
||||||
../../../src/utils.h
|
|
||||||
../../../src/utils.c
|
|
@ -1,57 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
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 cpython.bool cimport bool, PyBool_FromLong
|
|
||||||
from .capi.obitypes cimport index_t, \
|
|
||||||
const_char_p, \
|
|
||||||
OBIType_t, \
|
|
||||||
obibool_t, \
|
|
||||||
OBI_BOOL, \
|
|
||||||
OBIBool_NA
|
|
||||||
|
|
||||||
from .capi.obierrno cimport obi_errno
|
|
||||||
|
|
||||||
from ._obidmscolumn cimport OBIDMS_column, \
|
|
||||||
OBIDMS_column_line, \
|
|
||||||
OBIDMS_column_p, \
|
|
||||||
register_column_class
|
|
||||||
|
|
||||||
from .capi.obidmscolumn cimport obi_column_get_obibool_with_elt_name, \
|
|
||||||
obi_column_get_obibool_with_elt_idx, \
|
|
||||||
obi_column_set_obibool_with_elt_name, \
|
|
||||||
obi_column_set_obibool_with_elt_idx
|
|
||||||
|
|
||||||
|
|
||||||
from obitools3.utils cimport str2bytes, bytes2str
|
|
||||||
|
|
||||||
cdef class OBIDMS_column_line_bool(OBIDMS_column_line) :
|
|
||||||
cdef update_pointer(self)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cdef bool obibool_t2bool(obibool_t value)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cdef bool2obibool_t(bool value)
|
|
||||||
|
|
||||||
cpdef bool get_bool_item_by_name(self,bytes element_name)
|
|
||||||
cpdef bool get_bool_item_by_idx(self,index_t index)
|
|
||||||
cpdef set_bool_item_by_name(self,bytes element_name,bool value)
|
|
||||||
cpdef set_bool_item_by_idx(self,index_t index,bool value)
|
|
||||||
|
|
||||||
|
|
||||||
# cdef obibool_t [:] _data_view
|
|
||||||
|
|
||||||
cdef class OBIDMS_column_bool(OBIDMS_column):
|
|
||||||
cdef OBIDMS_column _new(OBIView view,
|
|
||||||
bytes column_name,
|
|
||||||
index_t nb_elements_per_line=1,
|
|
||||||
object elements_names=None,
|
|
||||||
bytes comments=b""):
|
|
||||||
|
|
||||||
cpdef object get_line(self, index_t line_nb)
|
|
||||||
cpdef set_line(self, index_t line_nb, object value)
|
|
||||||
|
|
@ -1,294 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBIDMS_column_line_bool(OBIDMS_column_line) :
|
|
||||||
|
|
||||||
cdef update_pointer(self):
|
|
||||||
"""
|
|
||||||
Checks if the obicolumn address changed since the last call and update
|
|
||||||
if need the `_column_p` and `_data_view` data structure fields.
|
|
||||||
"""
|
|
||||||
cdef OBIDMS_column_p column_p = self._column_pp[0]
|
|
||||||
|
|
||||||
if column_p != self._column_p:
|
|
||||||
self._column_p = column_p
|
|
||||||
# self._data_view = (<obibool_t*> (column_p.data)) + \
|
|
||||||
# self._index * column_p.header.nb_elements_per_line
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cdef bool obibool_t2bool(obibool_t value):
|
|
||||||
cdef bool result
|
|
||||||
|
|
||||||
if value == OBIBool_NA :
|
|
||||||
result = None
|
|
||||||
else :
|
|
||||||
result = PyBool_FromLong(value)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cdef bool2obibool_t(bool value):
|
|
||||||
cdef obibool_t result
|
|
||||||
|
|
||||||
if value is None:
|
|
||||||
result=OBIBool_NA
|
|
||||||
else:
|
|
||||||
result= <obibool_t> <int> value
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, OBIDMS_column column, index_t line_nb) :
|
|
||||||
"""
|
|
||||||
Creates a new `OBIDMS_column_line_bool`
|
|
||||||
|
|
||||||
@param column: an OBIDMS_column instance
|
|
||||||
@param line_nb: the line in the column
|
|
||||||
"""
|
|
||||||
|
|
||||||
OBIDMS_column_line.__init__(self,column,line_nb)
|
|
||||||
self.update_pointer()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cpdef bool get_bool_item_by_name(self,bytes element_name):
|
|
||||||
"""
|
|
||||||
Returns the value associated to the name `element_name` of the current line
|
|
||||||
|
|
||||||
@param element_name: a `bytes` instance containing the name of the element
|
|
||||||
|
|
||||||
@return: the `bool` value corresponding to the name
|
|
||||||
"""
|
|
||||||
cdef char* cname = element_name
|
|
||||||
cdef obibool_t value
|
|
||||||
global obi_errno
|
|
||||||
|
|
||||||
self.update_pointer()
|
|
||||||
|
|
||||||
value = obi_column_get_obibool_with_elt_name(self._column_p,
|
|
||||||
self._index,
|
|
||||||
cname)
|
|
||||||
|
|
||||||
if obi_errno > 0 :
|
|
||||||
obi_errno = 0
|
|
||||||
raise KeyError("Cannot access to key %s" % bytes2str(element_name))
|
|
||||||
|
|
||||||
return OBIDMS_column_line_bool.obibool_t2bool(value)
|
|
||||||
|
|
||||||
cpdef bool get_bool_item_by_idx(self,index_t index):
|
|
||||||
"""
|
|
||||||
Returns the value associated to the name `element_name` of the current line
|
|
||||||
|
|
||||||
@param index: a `int` instance containing the index of the element
|
|
||||||
|
|
||||||
@return: the `bool` value corresponding to the name
|
|
||||||
"""
|
|
||||||
cdef obibool_t value # @DuplicatedSignature
|
|
||||||
global obi_errno
|
|
||||||
|
|
||||||
|
|
||||||
self.update_pointer()
|
|
||||||
|
|
||||||
value = obi_column_get_obibool_with_elt_idx(self._column_p,
|
|
||||||
self._index,
|
|
||||||
index)
|
|
||||||
|
|
||||||
if obi_errno > 0 :
|
|
||||||
obi_errno = 0
|
|
||||||
raise IndexError("Cannot access to element %d" % index)
|
|
||||||
|
|
||||||
return OBIDMS_column_line_bool.obibool_t2bool(value)
|
|
||||||
|
|
||||||
|
|
||||||
def __getitem__(self, object element_name) :
|
|
||||||
cdef bytes name
|
|
||||||
cdef int cindex
|
|
||||||
cdef obibool_t value
|
|
||||||
cdef type typearg = type(element_name)
|
|
||||||
cdef bool result
|
|
||||||
|
|
||||||
|
|
||||||
if typearg == int:
|
|
||||||
cindex=element_name
|
|
||||||
if cindex < 0:
|
|
||||||
cindex = self._len - cindex
|
|
||||||
result=self.get_bool_item_by_idx(cindex)
|
|
||||||
elif typearg == bytes:
|
|
||||||
result=self.get_bool_item_by_name(element_name)
|
|
||||||
elif typearg == str:
|
|
||||||
name = str2bytes(element_name)
|
|
||||||
result=self.get_bool_item_by_name(name)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
cpdef set_bool_item_by_name(self,bytes element_name,bool value):
|
|
||||||
"""
|
|
||||||
Sets the value associated to the name `element_name` of the current line
|
|
||||||
|
|
||||||
@param element_name: a `bytes` instance containing the name of the element
|
|
||||||
@param value: a `bool` instance of the new value
|
|
||||||
|
|
||||||
@return: the `bool` value corresponding to the name
|
|
||||||
"""
|
|
||||||
cdef char* cname = element_name
|
|
||||||
cdef obibool_t cvalue
|
|
||||||
|
|
||||||
self.update_pointer()
|
|
||||||
cvalue = OBIDMS_column_line_bool.bool2obibool_t(value)
|
|
||||||
|
|
||||||
if ( obi_column_set_obibool_with_elt_name(self._column_p,
|
|
||||||
self._index,
|
|
||||||
cname,
|
|
||||||
cvalue) < 0 ):
|
|
||||||
raise KeyError("Cannot access to key %s" % bytes2str(element_name))
|
|
||||||
|
|
||||||
cpdef set_bool_item_by_idx(self,index_t index,bool value):
|
|
||||||
"""
|
|
||||||
Sets the value associated to the name `element_name` of the current line
|
|
||||||
|
|
||||||
@param index: a `int` instance containing the index of the element
|
|
||||||
@param value: a `bool` instance of the new value
|
|
||||||
|
|
||||||
@return: the `bool` value corresponding to the name
|
|
||||||
"""
|
|
||||||
cdef obibool_t cvalue # @DuplicatedSignature
|
|
||||||
|
|
||||||
self.update_pointer()
|
|
||||||
cvalue = OBIDMS_column_line_bool.bool2obibool_t(value)
|
|
||||||
|
|
||||||
if ( obi_column_set_obibool_with_elt_idx(self._column_p,
|
|
||||||
self._index,
|
|
||||||
index,
|
|
||||||
cvalue) < 0 ):
|
|
||||||
raise IndexError("Cannot access to item index %d" % index)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __setitem__(self, object element_name, object value):
|
|
||||||
cdef bytes name
|
|
||||||
cdef int cindex
|
|
||||||
cdef type typearg = type(element_name)
|
|
||||||
cdef bool result
|
|
||||||
|
|
||||||
|
|
||||||
if typearg == int:
|
|
||||||
cindex=element_name
|
|
||||||
if cindex < 0:
|
|
||||||
cindex = self._len - cindex
|
|
||||||
self.set_bool_item_by_idx(cindex,value)
|
|
||||||
elif typearg == bytes:
|
|
||||||
self.set_bool_item_by_name(element_name,value)
|
|
||||||
elif typearg == str:
|
|
||||||
name = str2bytes(element_name)
|
|
||||||
self.set_bool_item_by_name(name,value)
|
|
||||||
|
|
||||||
def __repr__(self) :
|
|
||||||
return str(self._column.get_line(self._index))
|
|
||||||
|
|
||||||
def __len__(self):
|
|
||||||
return self._len
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBIDMS_column_bool(OBIDMS_column):
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cdef OBIDMS_column _new(OBIView view,
|
|
||||||
bytes column_name,
|
|
||||||
index_t nb_elements_per_line=1,
|
|
||||||
object elements_names=None,
|
|
||||||
bytes comments=b""):
|
|
||||||
|
|
||||||
cdef bytes elements_names_b
|
|
||||||
cdef char* elements_names_p
|
|
||||||
cdef OBIDMS_column new_column
|
|
||||||
|
|
||||||
if elements_names is not None:
|
|
||||||
elements_names_b = b''.join([tobytes(x) for x in elements_names])
|
|
||||||
elements_names_p = elements_names_b
|
|
||||||
else:
|
|
||||||
elements_names_p = NULL
|
|
||||||
|
|
||||||
if (obi_view_add_column(view = view._pointer,
|
|
||||||
column_name = column_name,
|
|
||||||
version_number = -1,
|
|
||||||
alias = NULL,
|
|
||||||
data_type = OBI_BOOL,
|
|
||||||
nb_lines = len(view),
|
|
||||||
nb_elements_per_line = nb_elements_per_line,
|
|
||||||
elements_names = elements_names_p,
|
|
||||||
indexer_name = NULL,
|
|
||||||
associated_column_name = NULL,
|
|
||||||
associated_column_version = -1,
|
|
||||||
comments = comments,
|
|
||||||
create = True)<0):
|
|
||||||
raise RuntimeError("Cannot create column %s in view %s" % (bytes2str(column_name),
|
|
||||||
bytes2str(view.name)))
|
|
||||||
|
|
||||||
view.__init_columns__()
|
|
||||||
new_column = self._columns[column_name]
|
|
||||||
|
|
||||||
return new_column
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def new(OBIView view,
|
|
||||||
object column_name,
|
|
||||||
index_t nb_elements_per_line=1,
|
|
||||||
object elements_names=None,
|
|
||||||
object comments=b""):
|
|
||||||
|
|
||||||
return OBIDMS_column_bool._new(view,
|
|
||||||
tobytes(column_name),
|
|
||||||
nb_elements_per_line,
|
|
||||||
elements_names,
|
|
||||||
tobytes(comments))
|
|
||||||
|
|
||||||
cpdef add_to_view(self,
|
|
||||||
OBIView view,
|
|
||||||
object column_name=None,
|
|
||||||
object comments=b""):
|
|
||||||
|
|
||||||
cdef OBIDMS_column_p column_p = self._column_pp[0]
|
|
||||||
cdef bytes alias
|
|
||||||
|
|
||||||
if (column_name is None):
|
|
||||||
alias = self._alias
|
|
||||||
else:
|
|
||||||
alias = tobytes(column_name)
|
|
||||||
|
|
||||||
obi_view_add_column(view = view._ponter,
|
|
||||||
column_name = column_p.header.name,
|
|
||||||
version_number = column_p.header.version,
|
|
||||||
alias = alias,
|
|
||||||
data_type = OBI_BOOL,
|
|
||||||
nb_lines = column_p.header.lines_used,
|
|
||||||
nb_elements_per_line = column_p.header.nb_elements_per_line,
|
|
||||||
elements_names = column_p.header.elements_names,
|
|
||||||
indexer_name = NULL,
|
|
||||||
associated_column_name = NULL,
|
|
||||||
associated_column_version = NULL,
|
|
||||||
comments = tobytes(comments),
|
|
||||||
create = False)
|
|
||||||
|
|
||||||
cpdef object get_line(self, index_t line_nb):
|
|
||||||
cdef obibool_t value
|
|
||||||
cdef object result
|
|
||||||
global obi_errno
|
|
||||||
|
|
||||||
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 :
|
|
||||||
result = None
|
|
||||||
else :
|
|
||||||
result = PyBool_FromLong(value)
|
|
||||||
return result
|
|
||||||
|
|
||||||
cpdef set_line(self, index_t line_nb, object value):
|
|
||||||
if value is None :
|
|
||||||
value = OBIBool_NA
|
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
register_column_class(OBI_BOOL,OBIDMS_column_bool)
|
|
@ -1,65 +0,0 @@
|
|||||||
../../../src/bloom.h
|
|
||||||
../../../src/bloom.c
|
|
||||||
../../../src/char_str_indexer.h
|
|
||||||
../../../src/char_str_indexer.c
|
|
||||||
../../../src/crc64.h
|
|
||||||
../../../src/crc64.c
|
|
||||||
../../../src/dna_seq_indexer.h
|
|
||||||
../../../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
|
|
||||||
../../../src/obi_align.c
|
|
||||||
../../../src/obiavl.h
|
|
||||||
../../../src/obiavl.c
|
|
||||||
../../../src/obiblob_indexer.h
|
|
||||||
../../../src/obiblob_indexer.c
|
|
||||||
../../../src/obiblob.h
|
|
||||||
../../../src/obiblob.c
|
|
||||||
../../../src/obidebug.h
|
|
||||||
../../../src/obidms_taxonomy.h
|
|
||||||
../../../src/obidms_taxonomy.c
|
|
||||||
../../../src/obidms.h
|
|
||||||
../../../src/obidms.c
|
|
||||||
../../../src/obidmscolumn_blob.c
|
|
||||||
../../../src/obidmscolumn_blob.h
|
|
||||||
../../../src/obidmscolumn_bool.c
|
|
||||||
../../../src/obidmscolumn_bool.h
|
|
||||||
../../../src/obidmscolumn_char.c
|
|
||||||
../../../src/obidmscolumn_char.h
|
|
||||||
../../../src/obidmscolumn_float.c
|
|
||||||
../../../src/obidmscolumn_float.h
|
|
||||||
../../../src/obidmscolumn_idx.h
|
|
||||||
../../../src/obidmscolumn_idx.c
|
|
||||||
../../../src/obidmscolumn_int.c
|
|
||||||
../../../src/obidmscolumn_int.h
|
|
||||||
../../../src/obidmscolumn_qual.h
|
|
||||||
../../../src/obidmscolumn_qual.c
|
|
||||||
../../../src/obidmscolumn_seq.c
|
|
||||||
../../../src/obidmscolumn_seq.h
|
|
||||||
../../../src/obidmscolumn_str.c
|
|
||||||
../../../src/obidmscolumn_str.h
|
|
||||||
../../../src/obidmscolumn.h
|
|
||||||
../../../src/obidmscolumn.c
|
|
||||||
../../../src/obidmscolumndir.h
|
|
||||||
../../../src/obidmscolumndir.c
|
|
||||||
../../../src/obierrno.h
|
|
||||||
../../../src/obierrno.c
|
|
||||||
../../../src/obilittlebigman.h
|
|
||||||
../../../src/obilittlebigman.c
|
|
||||||
../../../src/obitypes.h
|
|
||||||
../../../src/obitypes.c
|
|
||||||
../../../src/obiview.h
|
|
||||||
../../../src/obiview.c
|
|
||||||
../../../src/sse_banded_LCS_alignment.h
|
|
||||||
../../../src/sse_banded_LCS_alignment.c
|
|
||||||
../../../src/uint8_indexer.h
|
|
||||||
../../../src/uint8_indexer.c
|
|
||||||
../../../src/upperband.h
|
|
||||||
../../../src/upperband.c
|
|
||||||
../../../src/utils.h
|
|
||||||
../../../src/utils.c
|
|
@ -1,21 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from ._obiview cimport OBIView_line
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Seq(dict) :
|
|
||||||
cdef str _id
|
|
||||||
cdef object _seq
|
|
||||||
cdef str _definition
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Nuc_Seq(OBI_Seq) :
|
|
||||||
cdef object _quality
|
|
||||||
cpdef object get_str_quality(self)
|
|
||||||
|
|
||||||
#cpdef object reverse_complement(self)
|
|
||||||
|
|
||||||
cdef class OBI_Nuc_Seq_Stored(OBIView_line) :
|
|
||||||
cpdef object get_str_quality(self)
|
|
||||||
|
|
||||||
#cpdef object reverse_complement(self)
|
|
@ -1,188 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from obitools3.utils cimport bytes2str, str2bytes
|
|
||||||
|
|
||||||
from .capi.obiview cimport NUC_SEQUENCE_COLUMN, \
|
|
||||||
ID_COLUMN, \
|
|
||||||
DEFINITION_COLUMN, \
|
|
||||||
QUALITY_COLUMN
|
|
||||||
from docutils.nodes import definition
|
|
||||||
|
|
||||||
|
|
||||||
cdef str __str__ID_COLUMN__ = bytes2str(ID_COLUMN)
|
|
||||||
cdef str __str__DEFINITION_COLUMN__ = bytes2str(DEFINITION_COLUMN)
|
|
||||||
cdef str __str__QUALITY_COLUMN__ = bytes2str(QUALITY_COLUMN)
|
|
||||||
cdef str __str__NUC_SEQUENCE_COLUMN__ = bytes2str(NUC_SEQUENCE_COLUMN)
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Seq(dict) :
|
|
||||||
|
|
||||||
def __init__(self, str id,
|
|
||||||
object seq,
|
|
||||||
str definition=None,
|
|
||||||
dict tags=None) :
|
|
||||||
|
|
||||||
if tags is not None:
|
|
||||||
self.update(tags)
|
|
||||||
|
|
||||||
self._id = id
|
|
||||||
self._seq = seq
|
|
||||||
|
|
||||||
if definition is not None :
|
|
||||||
self._definition = definition
|
|
||||||
else:
|
|
||||||
self._definition = None
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __getitem__(self,str key):
|
|
||||||
if key == __str__ID_COLUMN__:
|
|
||||||
return self._id
|
|
||||||
elif key == __str__DEFINITION_COLUMN__:
|
|
||||||
return self._definition
|
|
||||||
else:
|
|
||||||
return dict.__getitem__(self,key)
|
|
||||||
|
|
||||||
def __setitem__(self,str key,object value):
|
|
||||||
if key == __str__ID_COLUMN__:
|
|
||||||
self._id=value
|
|
||||||
elif key == __str__DEFINITION_COLUMN__:
|
|
||||||
self._definition=value
|
|
||||||
else:
|
|
||||||
dict.__setitem__(self,key,value)
|
|
||||||
|
|
||||||
# sequence id property getter and setter
|
|
||||||
@property
|
|
||||||
def id(self): # @ReservedAssignment
|
|
||||||
return self._id
|
|
||||||
@id.setter
|
|
||||||
def id(self, str new_id): # @ReservedAssignment @DuplicatedSignature
|
|
||||||
self._id = new_id
|
|
||||||
|
|
||||||
# sequence property getter and setter
|
|
||||||
@property
|
|
||||||
def seq(self):
|
|
||||||
return self._seq
|
|
||||||
@seq.setter
|
|
||||||
def seq(self, object new_seq): # @DuplicatedSignature
|
|
||||||
self._seq = new_seq
|
|
||||||
# self["SEQ"] = new_seq # TODO discuss
|
|
||||||
|
|
||||||
# sequence definition property getter and setter
|
|
||||||
@property
|
|
||||||
def definition(self):
|
|
||||||
return self._definition
|
|
||||||
@definition.setter
|
|
||||||
def definition(self, object new_definition): # @DuplicatedSignature
|
|
||||||
self._definition = new_definition
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Nuc_Seq(OBI_Seq) :
|
|
||||||
|
|
||||||
def __init__(self, str id,
|
|
||||||
object seq,
|
|
||||||
str quality=None,
|
|
||||||
str definition=None,
|
|
||||||
dict tags=None) :
|
|
||||||
OBI_Seq.__init__(self,id,seq,tags)
|
|
||||||
if quality is not None:
|
|
||||||
self._quality=quality
|
|
||||||
else:
|
|
||||||
self._quality=None
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __getitem__(self,str key):
|
|
||||||
if key == __str__NUC_SEQUENCE_COLUMN__:
|
|
||||||
return self._seq
|
|
||||||
elif key == __str__QUALITY_COLUMN__:
|
|
||||||
return self._quality
|
|
||||||
else:
|
|
||||||
return OBI_Seq.__getitem__(self,key)
|
|
||||||
|
|
||||||
def __setitem__(self,str key, object value):
|
|
||||||
if key == __str__NUC_SEQUENCE_COLUMN__:
|
|
||||||
self._seq = value
|
|
||||||
elif key == __str__QUALITY_COLUMN__:
|
|
||||||
self._quality=value
|
|
||||||
else:
|
|
||||||
OBI_Seq.__setitem__(self,key,value)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cpdef object get_str_quality(self) : # TODO not ideal. Make quality_int and quality_str properties
|
|
||||||
return self._quality
|
|
||||||
|
|
||||||
# nuc sequence property getter and setter
|
|
||||||
@property
|
|
||||||
def seq(self):
|
|
||||||
return self._seq
|
|
||||||
@seq.setter
|
|
||||||
def seq(self, object new_seq): # @DuplicatedSignature
|
|
||||||
self._seq = new_seq
|
|
||||||
# self[bytes2str(NUC_SEQUENCE_COLUMN)] = new_seq
|
|
||||||
|
|
||||||
# sequence quality property getter and setter
|
|
||||||
@property
|
|
||||||
def quality(self):
|
|
||||||
return self._quality
|
|
||||||
@quality.setter
|
|
||||||
def quality(self, object new_quality): # @DuplicatedSignature
|
|
||||||
self._quality = new_quality
|
|
||||||
# self[bytes2str(QUALITY_COLUMN)] = new_quality
|
|
||||||
|
|
||||||
# cpdef str reverse_complement(self) : TODO in C ?
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Nuc_Seq_Stored(OBIView_line) :
|
|
||||||
|
|
||||||
# TODO store the str version of column name macros?
|
|
||||||
|
|
||||||
# sequence id property getter and setter
|
|
||||||
@property
|
|
||||||
def id(self): # @ReservedAssignment @DuplicatedSignature
|
|
||||||
return self[__str__ID_COLUMN__]
|
|
||||||
|
|
||||||
@id.setter
|
|
||||||
def id(self, str new_id): # @ReservedAssignment @DuplicatedSignature
|
|
||||||
self[__str__ID_COLUMN__] = new_id
|
|
||||||
|
|
||||||
# sequence definition property getter and setter
|
|
||||||
@property
|
|
||||||
def definition(self):
|
|
||||||
return self[__str__DEFINITION_COLUMN__]
|
|
||||||
|
|
||||||
@definition.setter
|
|
||||||
def definition(self, str new_def): # @DuplicatedSignature
|
|
||||||
self[__str__DEFINITION_COLUMN__] = new_def
|
|
||||||
|
|
||||||
# nuc_seq property getter and setter
|
|
||||||
@property
|
|
||||||
def nuc_seq(self):
|
|
||||||
return self[__str__NUC_SEQUENCE_COLUMN__]
|
|
||||||
|
|
||||||
@nuc_seq.setter
|
|
||||||
def nuc_seq(self, object new_seq): # @DuplicatedSignature
|
|
||||||
self[__str__NUC_SEQUENCE_COLUMN__] = new_seq
|
|
||||||
|
|
||||||
# quality property getter and setter
|
|
||||||
@property
|
|
||||||
def quality(self):
|
|
||||||
return self[__str__QUALITY_COLUMN__]
|
|
||||||
|
|
||||||
@quality.setter
|
|
||||||
def quality(self, object new_qual): # @DuplicatedSignature
|
|
||||||
if (type(new_qual) == list) or (new_qual is None) : # TODO check that quality column exists
|
|
||||||
self[__str__QUALITY_COLUMN__] = new_qual
|
|
||||||
else : # Quality is in str form
|
|
||||||
(((self._view).columns)[__str__QUALITY_COLUMN__]).set_str_line(self._index, new_qual)
|
|
||||||
|
|
||||||
cpdef object get_str_quality(self) : # TODO not ideal. Make quality_int and quality_str properties
|
|
||||||
return ((self._view).columns)[__str__QUALITY_COLUMN__].get_str_line(self._index)
|
|
||||||
|
|
||||||
# cpdef str reverse_complement(self) : TODO in C ?
|
|
||||||
# pass
|
|
||||||
|
|
||||||
# TODO static method to import OBI_Nuc_Seq to OBI_Nuc_Seq_Stored ?
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
|||||||
../../../src/bloom.h
|
|
||||||
../../../src/bloom.c
|
|
||||||
../../../src/char_str_indexer.h
|
|
||||||
../../../src/char_str_indexer.c
|
|
||||||
../../../src/crc64.h
|
|
||||||
../../../src/crc64.c
|
|
||||||
../../../src/dna_seq_indexer.h
|
|
||||||
../../../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
|
|
||||||
../../../src/obi_align.c
|
|
||||||
../../../src/obiavl.h
|
|
||||||
../../../src/obiavl.c
|
|
||||||
../../../src/obiblob_indexer.h
|
|
||||||
../../../src/obiblob_indexer.c
|
|
||||||
../../../src/obiblob.h
|
|
||||||
../../../src/obiblob.c
|
|
||||||
../../../src/obidebug.h
|
|
||||||
../../../src/obidms_taxonomy.h
|
|
||||||
../../../src/obidms_taxonomy.c
|
|
||||||
../../../src/obidms.h
|
|
||||||
../../../src/obidms.c
|
|
||||||
../../../src/obidmscolumn_blob.c
|
|
||||||
../../../src/obidmscolumn_blob.h
|
|
||||||
../../../src/obidmscolumn_bool.c
|
|
||||||
../../../src/obidmscolumn_bool.h
|
|
||||||
../../../src/obidmscolumn_char.c
|
|
||||||
../../../src/obidmscolumn_char.h
|
|
||||||
../../../src/obidmscolumn_float.c
|
|
||||||
../../../src/obidmscolumn_float.h
|
|
||||||
../../../src/obidmscolumn_idx.h
|
|
||||||
../../../src/obidmscolumn_idx.c
|
|
||||||
../../../src/obidmscolumn_int.c
|
|
||||||
../../../src/obidmscolumn_int.h
|
|
||||||
../../../src/obidmscolumn_qual.h
|
|
||||||
../../../src/obidmscolumn_qual.c
|
|
||||||
../../../src/obidmscolumn_seq.c
|
|
||||||
../../../src/obidmscolumn_seq.h
|
|
||||||
../../../src/obidmscolumn_str.c
|
|
||||||
../../../src/obidmscolumn_str.h
|
|
||||||
../../../src/obidmscolumn.h
|
|
||||||
../../../src/obidmscolumn.c
|
|
||||||
../../../src/obidmscolumndir.h
|
|
||||||
../../../src/obidmscolumndir.c
|
|
||||||
../../../src/obierrno.h
|
|
||||||
../../../src/obierrno.c
|
|
||||||
../../../src/obilittlebigman.h
|
|
||||||
../../../src/obilittlebigman.c
|
|
||||||
../../../src/obitypes.h
|
|
||||||
../../../src/obitypes.c
|
|
||||||
../../../src/obiview.h
|
|
||||||
../../../src/obiview.c
|
|
||||||
../../../src/sse_banded_LCS_alignment.h
|
|
||||||
../../../src/sse_banded_LCS_alignment.c
|
|
||||||
../../../src/uint8_indexer.h
|
|
||||||
../../../src/uint8_indexer.c
|
|
||||||
../../../src/upperband.h
|
|
||||||
../../../src/upperband.c
|
|
||||||
../../../src/utils.h
|
|
||||||
../../../src/utils.c
|
|
@ -1,20 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from .capi.obitaxonomy cimport ecotx_t, OBIDMS_taxonomy_p
|
|
||||||
from ._obidms cimport OBIDMS
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Taxonomy :
|
|
||||||
|
|
||||||
cdef str _name
|
|
||||||
cdef OBIDMS_taxonomy_p _pointer
|
|
||||||
cdef OBIDMS _dms
|
|
||||||
|
|
||||||
cpdef write(self, str prefix)
|
|
||||||
cpdef int add_taxon(self, str name, str rank_name, int parent_taxid, int min_taxid=*)
|
|
||||||
cpdef close(self)
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Taxon :
|
|
||||||
|
|
||||||
cdef ecotx_t* _pointer
|
|
@ -1,129 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from obitools3.utils cimport bytes2str, str2bytes
|
|
||||||
|
|
||||||
from .capi.obitaxonomy cimport obi_read_taxonomy, \
|
|
||||||
obi_read_taxdump, \
|
|
||||||
obi_write_taxonomy, \
|
|
||||||
obi_close_taxonomy, \
|
|
||||||
obi_taxo_get_taxon_with_taxid, \
|
|
||||||
obi_taxonomy_add_local_taxon, \
|
|
||||||
ecotx_t
|
|
||||||
|
|
||||||
|
|
||||||
from ._obidms cimport OBIDMS
|
|
||||||
|
|
||||||
from cpython.pycapsule cimport PyCapsule_New, PyCapsule_GetPointer
|
|
||||||
from logging import raiseExceptions
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Taxonomy :
|
|
||||||
|
|
||||||
# TODO function to import taxonomy?
|
|
||||||
|
|
||||||
def __init__(self, OBIDMS dms, str name, bint taxdump=False) :
|
|
||||||
|
|
||||||
self._dms = dms
|
|
||||||
self._name = name
|
|
||||||
if taxdump :
|
|
||||||
self._pointer = obi_read_taxdump(str2bytes(name))
|
|
||||||
else :
|
|
||||||
self._pointer = obi_read_taxonomy(dms._pointer, str2bytes(name), True) # TODO discuss
|
|
||||||
# TODO if not found in DMS, try to import?
|
|
||||||
|
|
||||||
|
|
||||||
def __getitem__(self, object ref):
|
|
||||||
|
|
||||||
cdef ecotx_t* taxon_p
|
|
||||||
cdef object taxon_capsule
|
|
||||||
|
|
||||||
if type(ref) == int :
|
|
||||||
taxon_p = obi_taxo_get_taxon_with_taxid(self._pointer, ref)
|
|
||||||
if taxon_p == NULL :
|
|
||||||
raise Exception("Taxon not found")
|
|
||||||
taxon_capsule = PyCapsule_New(taxon_p, NULL, NULL)
|
|
||||||
return OBI_Taxon(taxon_capsule)
|
|
||||||
else :
|
|
||||||
raise Exception("Not implemented")
|
|
||||||
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
|
|
||||||
cdef ecotx_t* taxa
|
|
||||||
cdef ecotx_t* taxon_p
|
|
||||||
cdef object taxon_capsule
|
|
||||||
cdef int t
|
|
||||||
|
|
||||||
taxa = self._pointer.taxa.taxon
|
|
||||||
|
|
||||||
# Yield each taxid
|
|
||||||
for t in range(self._pointer.taxa.count):
|
|
||||||
taxon_p = <ecotx_t*> (taxa+t)
|
|
||||||
taxon_capsule = PyCapsule_New(taxon_p, NULL, NULL)
|
|
||||||
yield OBI_Taxon(taxon_capsule)
|
|
||||||
|
|
||||||
|
|
||||||
cpdef write(self, str prefix) :
|
|
||||||
if obi_write_taxonomy(self._dms._pointer, self._pointer, str2bytes(prefix)) < 0 :
|
|
||||||
raise Exception("Error writing the taxonomy to binary files")
|
|
||||||
|
|
||||||
|
|
||||||
cpdef int add_taxon(self, str name, str rank_name, int parent_taxid, int min_taxid=10000000) :
|
|
||||||
cdef int taxid
|
|
||||||
taxid = obi_taxonomy_add_local_taxon(self._pointer, str2bytes(name), str2bytes(rank_name), parent_taxid, min_taxid)
|
|
||||||
if taxid < 0 :
|
|
||||||
raise Exception("Error adding a new taxon to the taxonomy")
|
|
||||||
else :
|
|
||||||
return taxid
|
|
||||||
|
|
||||||
|
|
||||||
cpdef close(self) :
|
|
||||||
if (obi_close_taxonomy(self._pointer) < 0) :
|
|
||||||
raise Exception("Error closing the taxonomy")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBI_Taxon : # TODO dict subclass?
|
|
||||||
|
|
||||||
def __init__(self, object taxon_capsule) :
|
|
||||||
self._pointer = <ecotx_t*> PyCapsule_GetPointer(taxon_capsule, NULL)
|
|
||||||
if self._pointer == NULL :
|
|
||||||
raise Exception("Error reading the taxonomy")
|
|
||||||
|
|
||||||
# name property getter
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
return bytes2str(self._pointer.name)
|
|
||||||
|
|
||||||
# taxid property getter
|
|
||||||
@property
|
|
||||||
def taxid(self):
|
|
||||||
return self._pointer.taxid
|
|
||||||
|
|
||||||
# rank property getter
|
|
||||||
@property
|
|
||||||
def rank(self):
|
|
||||||
return self._pointer.rank
|
|
||||||
|
|
||||||
# farest property getter
|
|
||||||
@property
|
|
||||||
def farest(self):
|
|
||||||
return self._pointer.farest
|
|
||||||
|
|
||||||
# parent property getter
|
|
||||||
@property
|
|
||||||
def parent(self):
|
|
||||||
cdef object parent_capsule
|
|
||||||
parent_capsule = PyCapsule_New(self._pointer.parent, NULL, NULL)
|
|
||||||
return OBI_Taxon(parent_capsule)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
d = {}
|
|
||||||
d['taxid'] = self.taxid
|
|
||||||
d['name'] = self.name
|
|
||||||
d['parent'] = self.parent.taxid
|
|
||||||
d['farest'] = self.farest
|
|
||||||
return str(d)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from ._obiview cimport OBIView
|
|
||||||
from ._obiseq cimport OBI_Nuc_Seq, OBI_Nuc_Seq_Stored
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS_QUAL(OBIView_NUC_SEQS):
|
|
||||||
cpdef OBIView clone(self,
|
|
||||||
str view_name,
|
|
||||||
OBIView_line_selection line_selection=*,
|
|
||||||
str comments=*)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView new(OBIDMS dms,
|
|
||||||
str view_name,
|
|
||||||
str comments=*)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView open(OBIDMS dms,
|
|
||||||
str view_name)
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS_line_selection(OBIView_line_selection):
|
|
||||||
cpdef OBIView materialize(self,
|
|
||||||
str view_name,
|
|
||||||
str comments=*)
|
|
@ -1,105 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from .capi.obitypes cimport index_t
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS(OBIView):
|
|
||||||
|
|
||||||
cpdef OBIView clone(self,
|
|
||||||
str view_name,
|
|
||||||
str comments=""):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS(987654)
|
|
||||||
|
|
||||||
view._pointer = obi_new_view_nuc_seqs(self._pointer.dms,
|
|
||||||
str2bytes(view_name),
|
|
||||||
self._pointer,
|
|
||||||
NULL,
|
|
||||||
str2bytes(comments),
|
|
||||||
False)
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot clone view %s into view %s"
|
|
||||||
% (str(self.name),
|
|
||||||
view_name)
|
|
||||||
)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView new(OBIDMS dms,
|
|
||||||
str view_name,
|
|
||||||
str comments=""):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS(987654) # @DuplicatedSignature
|
|
||||||
|
|
||||||
view._pointer = obi_new_view_nuc_seqs(dms._pointer,
|
|
||||||
str2bytes(view_name),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
str2bytes(comments),
|
|
||||||
False)
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot create view %s" % view_name)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView open(OBIDMS dms,
|
|
||||||
str view_name):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS(987654) # @DuplicatedSignature
|
|
||||||
|
|
||||||
view._pointer = obi_open_view(dms._pointer,
|
|
||||||
str2bytes(view_name))
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot open view %s" % view_name)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
||||||
|
|
||||||
cpdef OBIView_line_selection new_selection(self,list lines=None):
|
|
||||||
return OBIView_NUC_SEQS_line_selection(self,lines)
|
|
||||||
|
|
||||||
def __getitem__(self, object item) :
|
|
||||||
if type(item) == str :
|
|
||||||
return (self._columns)[item]
|
|
||||||
elif type(item) == int :
|
|
||||||
return OBI_Nuc_Seq_Stored(self, item)
|
|
||||||
|
|
||||||
|
|
||||||
def __setitem__(self, index_t line_idx, OBI_Nuc_Seq sequence_obj) :
|
|
||||||
for key in sequence_obj :
|
|
||||||
self[line_idx][key] = sequence_obj[key]
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS_line_selection(OBIView_line_selection):
|
|
||||||
|
|
||||||
cpdef OBIView materialize(self,
|
|
||||||
str view_name,
|
|
||||||
str comments=""):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS(987654)
|
|
||||||
|
|
||||||
view._pointer = obi_new_view(self._view._pointer.dms,
|
|
||||||
str2bytes(view_name),
|
|
||||||
self._view._pointer,
|
|
||||||
self.__build_binary_list__(),
|
|
||||||
str2bytes(comments))
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot clone view %s into view %s"
|
|
||||||
% (str(self.name),
|
|
||||||
view_name)
|
|
||||||
)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
@ -1,25 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from ._obidms cimport OBIView
|
|
||||||
from ._obiseq cimport OBI_Nuc_Seq, OBI_Nuc_Seq_Stored
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS_QUAL(OBIView_NUC_SEQS):
|
|
||||||
cpdef OBIView clone(self,
|
|
||||||
str view_name,
|
|
||||||
OBIView_line_selection line_selection=*,
|
|
||||||
str comments=*)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView new(OBIDMS dms,
|
|
||||||
str view_name,
|
|
||||||
str comments=*)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView open(OBIDMS dms,
|
|
||||||
str view_name)
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS_QUAL_line_selection(OBIView_NUC_SEQS_line_selection):
|
|
||||||
cpdef OBIView materialize(self,
|
|
||||||
str view_name,
|
|
||||||
str comments=*)
|
|
@ -1,90 +0,0 @@
|
|||||||
#cython: language_level=3
|
|
||||||
|
|
||||||
from .capi.obitypes cimport index_t
|
|
||||||
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS_QUAL(OBIView_NUC_SEQS):
|
|
||||||
|
|
||||||
cpdef OBIView clone(self,
|
|
||||||
str view_name,
|
|
||||||
str comments=""):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS_QUAL(987654)
|
|
||||||
|
|
||||||
view._pointer = obi_new_view_nuc_seqs(self._pointer.dms,
|
|
||||||
str2bytes(view_name),
|
|
||||||
self._pointer,
|
|
||||||
NULL,
|
|
||||||
str2bytes(comments),
|
|
||||||
True)
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot clone view %s into view %s"
|
|
||||||
% (str(self.name),
|
|
||||||
view_name)
|
|
||||||
)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView new(OBIDMS dms,
|
|
||||||
str view_name,
|
|
||||||
str comments=""):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS_QUAL(987654) # @DuplicatedSignature
|
|
||||||
|
|
||||||
view._pointer = obi_new_view_nuc_seqs(dms._pointer,
|
|
||||||
str2bytes(view_name),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
str2bytes(comments),
|
|
||||||
True)
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot create view %s" % view_name)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
cpdef OBIView open(OBIDMS dms,
|
|
||||||
str view_name):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS_QUAL(987654) # @DuplicatedSignature
|
|
||||||
|
|
||||||
view._pointer = obi_open_view(dms._pointer,
|
|
||||||
str2bytes(view_name))
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot open view %s" % view_name)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
||||||
|
|
||||||
cdef class OBIView_NUC_SEQS_QUAL_line_selection(OBIView_NUC_SEQS_line_selection):
|
|
||||||
|
|
||||||
cpdef OBIView materialize(self,
|
|
||||||
str view_name,
|
|
||||||
str comments=""):
|
|
||||||
|
|
||||||
cdef OBIView view = OBIView_NUC_SEQS_QUAL(987654)
|
|
||||||
|
|
||||||
view._pointer = obi_new_view(self._view._pointer.dms,
|
|
||||||
str2bytes(view_name),
|
|
||||||
self._view._pointer,
|
|
||||||
self.__build_binary_list__(),
|
|
||||||
str2bytes(comments))
|
|
||||||
|
|
||||||
if view._pointer == NULL :
|
|
||||||
raise RuntimeError("Error : Cannot clone view %s into view %s"
|
|
||||||
% (str(self.name),
|
|
||||||
view_name)
|
|
||||||
)
|
|
||||||
|
|
||||||
view.__init_columns__(self)
|
|
||||||
|
|
||||||
return view
|
|
Reference in New Issue
Block a user