diff --git a/python/obitools3/obidms/_obidms.pxd b/python/obitools3/obidms/_obidms.pxd index 20c5375..99478d5 100644 --- a/python/obitools3/obidms/_obidms.pxd +++ b/python/obitools3/obidms/_obidms.pxd @@ -67,10 +67,6 @@ cdef class OBIView: cdef object get_view_subclass(str view_type) -cdef class OBIView_NUC_SEQS(OBIView) : - pass - - cdef class OBIView_line : cdef index_t _index diff --git a/python/obitools3/obidms/_obidms.pyx b/python/obitools3/obidms/_obidms.pyx index c35cd14..532c788 100644 --- a/python/obitools3/obidms/_obidms.pyx +++ b/python/obitools3/obidms/_obidms.pyx @@ -30,8 +30,6 @@ from ._obidms cimport OBIDMS, \ from ._obitaxo cimport OBI_Taxonomy -from ._obiseq cimport OBI_Nuc_Seq, OBI_Nuc_Seq_Stored - from ._obidmscolumn_int cimport OBIDMS_column_int, \ OBIDMS_column_multi_elts_int @@ -132,7 +130,7 @@ cdef class OBIDMS_column : def alias(self): return self._alias @alias.setter - def alias(self, new_alias): + def alias(self, new_alias): # @DuplicatedSignature self._view.change_column_alias(self._alias, new_alias) # elements_names property getter @@ -490,7 +488,7 @@ cdef class OBIView : # view type property getter @property - def type(self): + def type(self): # @ReservedAssignment return bytes2str(self._pointer.infos.view_type) # columns property getter @@ -518,20 +516,6 @@ cdef class OBIView : ###################################################################################################### -cdef class OBIView_NUC_SEQS(OBIView): - - - 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] - ###################################################################################################### @@ -609,9 +593,9 @@ cdef class OBIView_line_selection(list): def append(self, index_t idx) : if idx >= self._view.line_count : raise Exception("Error: trying to select a line beyond the line count of a view") - # if idx in self : # TODO discuss. Discuss order too - # pass - # else : +# if idx in self : # TODO discuss. Discuss order too +# pass +# else : super(OBIView_line_selection, self).append(idx) @@ -663,7 +647,7 @@ cdef class OBIDMS : cpdef OBIView clone_view(self, str view_name, object view_to_clone, str comments="") : - cdef object view_class + cdef object view_class # @DuplicatedSignature cdef str view_type # Get right subclass depending on view type if type(view_to_clone) == str : @@ -675,7 +659,7 @@ cdef class OBIDMS : cpdef OBIView clone_view_with_line_selection(self, str view_name, OBIView_line_selection line_selection, str comments="") : - cdef object view_class + cdef object view_class # @DuplicatedSignature # Get right subclass depending on view type view_class = OBIView.get_view_subclass(line_selection._view.type) return view_class(self, view_name, new=True, view_to_clone=line_selection._view, line_selection=line_selection, comments=comments) diff --git a/python/obitools3/obidms/_obiview_nuc_seq.pxd b/python/obitools3/obidms/_obiview_nuc_seq.pxd new file mode 100644 index 0000000..0fa72d3 --- /dev/null +++ b/python/obitools3/obidms/_obiview_nuc_seq.pxd @@ -0,0 +1,8 @@ +#cython: language_level=3 + +from ._obidms cimport OBIView +from ._obiseq cimport OBI_Nuc_Seq, OBI_Nuc_Seq_Stored + + +cdef class OBIView_NUC_SEQS(OBIView): + pass \ No newline at end of file diff --git a/python/obitools3/obidms/_obiview_nuc_seq.pyx b/python/obitools3/obidms/_obiview_nuc_seq.pyx new file mode 100644 index 0000000..141a6ac --- /dev/null +++ b/python/obitools3/obidms/_obiview_nuc_seq.pyx @@ -0,0 +1,19 @@ +#cython: language_level=3 + +from .capi.obitypes cimport index_t + + +cdef class OBIView_NUC_SEQS(OBIView): + + + 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] +