Move the OBIView_NUC_SEQS class to files _obiview_nuc_seq.pxd and

_obiview_nuc_seq.pyx to avoid circular inclusion
This commit is contained in:
2016-12-13 12:46:49 +01:00
parent fc805e5443
commit 4ef5cb0d87
4 changed files with 34 additions and 27 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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]