Added view type property to OBIView cython class and updated obi export

to use it
This commit is contained in:
Celine Mercier
2016-11-08 17:49:59 +01:00
parent 51b23915ca
commit 359578814b
2 changed files with 12 additions and 5 deletions

View File

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