Cython: added possibility to output in tabular format
This commit is contained in:
@ -15,14 +15,18 @@ from obitools3.parsers.universal import entryIteratorFactory
|
||||
|
||||
from obitools3.writers.fasta import FastaNucWriter
|
||||
from obitools3.writers.fastq import FastqWriter
|
||||
from obitools3.writers.tab import TabWriter
|
||||
from obitools3.format.fasta import FastaFormat
|
||||
from obitools3.format.fastq import FastqFormat
|
||||
from obitools3.format.tab import TabFormat
|
||||
|
||||
from obitools3.dms.obiseq import Nuc_Seq
|
||||
from obitools3.apps.config import getConfiguration,logger
|
||||
from obitools3.apps.temp import get_temp_dms
|
||||
from obitools3.utils cimport tobytes, count_entries # TODO tobytes because can't read options as bytes
|
||||
|
||||
from obitools3.files.universalopener cimport uopen
|
||||
|
||||
from obitools3.dms.capi.obierrno cimport obi_errno, \
|
||||
OBIVIEW_ALREADY_EXISTS_ERROR
|
||||
|
||||
@ -283,17 +287,18 @@ def open_uri(uri,
|
||||
format=config["obi"][formatkey]
|
||||
except KeyError:
|
||||
format=None
|
||||
|
||||
|
||||
if b'seqtype' in qualifiers:
|
||||
seqtype=qualifiers[b'seqtype'][0]
|
||||
else:
|
||||
if format == b"ngsfilter": # TODO discuss
|
||||
if format == b"ngsfilter" or format == b"tabular": # TODO discuss
|
||||
seqtype=None
|
||||
else:
|
||||
try:
|
||||
seqtype=config["obi"]["seqtype"]
|
||||
except KeyError:
|
||||
seqtype=b"nuc"
|
||||
config["obi"]["seqtype"] = seqtype
|
||||
|
||||
if b'skip' in qualifiers:
|
||||
skip=int(qualifiers[b"skip"][0])
|
||||
@ -504,7 +509,11 @@ def open_uri(uri,
|
||||
skip = skip,
|
||||
only = only)
|
||||
else:
|
||||
raise NotImplementedError('Output sequence file format not implemented')
|
||||
iseq = TabWriter(TabFormat(header=header, NAString=nastring, sep=sep),
|
||||
file,
|
||||
skip=skip,
|
||||
only=only,
|
||||
header=header)
|
||||
elif format==b"ngsfilter":
|
||||
objclass = dict
|
||||
if input:
|
||||
|
Reference in New Issue
Block a user