Added view type property to OBIView cython class and updated obi export
to use it
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from obitools3.apps.progress cimport ProgressBar # @UnresolvedImport
|
||||
from obitools3.obidms._obidms import OBIDMS, OBIView_NUC_SEQS # TODO cimport doesn't work
|
||||
from obitools3.obidms._obidms import OBIDMS # TODO cimport doesn't work
|
||||
from obitools3.utils cimport bytes2str
|
||||
|
||||
import time
|
||||
@ -56,8 +56,10 @@ def run(config):
|
||||
# Open input view
|
||||
iview = d.open_view(config['obi']['inputview'])
|
||||
|
||||
print(iview.type)
|
||||
|
||||
# TODO check that the view has the type NUC_SEQS
|
||||
if ((config['export']['format'] == "fasta") or (config['export']['format'] == "fastq")) and (isinstance(iview, OBIView_NUC_SEQS) == False) :
|
||||
if ((config['export']['format'] == "fasta") or (config['export']['format'] == "fastq")) and (iview.type != "NUC_SEQS_VIEW") : # TODO find a way to import those macros
|
||||
raise Exception("Error: the view to export in fasta or fastq format is not a NUC_SEQS view")
|
||||
|
||||
# Initialize the progress bar
|
||||
|
@ -489,7 +489,12 @@ cdef class OBIView :
|
||||
@property
|
||||
def name(self):
|
||||
return bytes2str(self._pointer.infos.name)
|
||||
|
||||
|
||||
# view type property getter
|
||||
@property
|
||||
def type(self):
|
||||
return bytes2str(self._pointer.infos.view_type)
|
||||
|
||||
# columns property getter
|
||||
@property
|
||||
def columns(self):
|
||||
@ -724,8 +729,8 @@ cdef class OBIDMS :
|
||||
# Check the type of the view to clone if there is one # TODO make generic for future other view types
|
||||
if (view_to_clone is not None and \
|
||||
((type(view_to_clone) == str and self.read_view_infos(view_to_clone)["view_type"] == bytes2str(VIEW_TYPE_NUC_SEQS)) or \
|
||||
isinstance(view_to_clone, OBIView_NUC_SEQS))) or \
|
||||
(line_selection is not None and isinstance(line_selection._view, OBIView_NUC_SEQS)) :
|
||||
(view_to_clone.type == bytes2str(VIEW_TYPE_NUC_SEQS)))) or \
|
||||
(line_selection is not None and (line_selection._view.type == bytes2str(VIEW_TYPE_NUC_SEQS))) :
|
||||
view_type = bytes2str(VIEW_TYPE_NUC_SEQS)
|
||||
view_class = OBIView_NUC_SEQS
|
||||
|
||||
|
Reference in New Issue
Block a user