Bug fixes for input handlers, openers, parsers etc. Compiling but not
tested
This commit is contained in:
@ -6,11 +6,14 @@ Created on 30 mars 2016
|
||||
@author: coissac
|
||||
'''
|
||||
|
||||
from obitools3.dms.obiseq import Nuc_Seq
|
||||
|
||||
|
||||
def fastqIterator(lineiterator,
|
||||
int skip=0,
|
||||
only=None,
|
||||
int qualityoffset=-1,
|
||||
bool noquality=False,
|
||||
bint noquality=False,
|
||||
firstline=None,
|
||||
int buffersize=100000000
|
||||
):
|
||||
|
7
python/obitools3/parsers/universal.pxd
Normal file
7
python/obitools3/parsers/universal.pxd
Normal file
@ -0,0 +1,7 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from ..utils cimport str2bytes
|
||||
|
||||
from ..files.universalopener cimport uopen
|
||||
from ..files.linebuffer cimport LineBuffer
|
||||
from obitools3.dms.obiseq cimport Nuc_Seq
|
6
python/obitools3/uri/decode.pxd
Normal file
6
python/obitools3/uri/decode.pxd
Normal file
@ -0,0 +1,6 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from obitools3.dms.dms cimport DMS
|
||||
from obitools3.dms.view.view cimport View
|
||||
from obitools3.dms.column.column cimport Column
|
||||
from obitools3.dms.taxo.taxo cimport Taxonomy
|
@ -1,12 +1,11 @@
|
||||
from urllib.parse import urlparse, parse_qs, ParseResultBytes
|
||||
#cython: language_level=3
|
||||
|
||||
from urllib.parse import urlparse, urlunparse, parse_qs, ParseResultBytes
|
||||
from os.path import isdir, isfile, basename, join
|
||||
|
||||
from obitools3.utils import tobytes
|
||||
|
||||
from obitools3.dms.dms import DMS
|
||||
from obitools3.dms.view.view import View
|
||||
from obitools3.dms.column.column import Column
|
||||
from obitools3.dms.taxo import Taxonomy
|
||||
|
||||
from obitools3.files.universalopener import uopen
|
||||
from obitools3.parsers.fasta import fastaNucIterator
|
||||
@ -15,7 +14,7 @@ from obitools3.parsers.universal import entryIteratorFactory
|
||||
|
||||
from obitools3.dms.obiseq import Nuc_Seq
|
||||
|
||||
cdef class MalformedURIException(RuntimeError):
|
||||
class MalformedURIException(RuntimeError):
|
||||
pass
|
||||
|
||||
cdef open_dms(bytes path,create=False):
|
||||
@ -30,10 +29,10 @@ cdef open_dms(bytes path,create=False):
|
||||
while(pos>0):
|
||||
pos = path.find(b"/",pos)
|
||||
if pos>0:
|
||||
dirpath=path[0:pos]
|
||||
dmspath=path[0:pos]
|
||||
else:
|
||||
dirpath=path
|
||||
if not isdir(dirpath):
|
||||
dmspath=path
|
||||
if not isdir(dmspath):
|
||||
dmsdirname=dmspath+b".obidms"
|
||||
if isdir(dmsdirname):
|
||||
dmsname=basename(dmspath)
|
||||
@ -70,7 +69,7 @@ def open_dms_element(DMS dms, bytes path):
|
||||
if len(path_parts) == 2:
|
||||
taxon=taxo[int(path_parts[2])]
|
||||
return (dms,taxon)
|
||||
elif (len(path_parts) > 2:
|
||||
elif len(path_parts) > 2:
|
||||
raise MalformedURIException('Malformed Taxonomy URI')
|
||||
return (dms,taxo)
|
||||
|
||||
@ -148,7 +147,7 @@ def open_uri(uri,input=True,config={}):
|
||||
scheme=b'file'
|
||||
dms = open_dms(urip.path)
|
||||
if dms is None and default_dms is not None:
|
||||
dms=(default_dms,urip.path))
|
||||
dms=(default_dms,urip.path)
|
||||
|
||||
|
||||
if dms is not None:
|
||||
@ -198,7 +197,7 @@ def open_uri(uri,input=True,config={}):
|
||||
seqtype=config["obi"]["seqtype"]
|
||||
|
||||
if b'skip' in qualifiers:
|
||||
skip=int(qualifiers[b"skip"][0]
|
||||
skip=int(qualifiers[b"skip"][0])
|
||||
else:
|
||||
skip=config["obi"]["skeep"]
|
||||
if skip < 0:
|
||||
@ -290,16 +289,16 @@ def open_uri(uri,input=True,config={}):
|
||||
raise MalformedURIException('Malformed blanklineskip argument in URI')
|
||||
|
||||
if b"commentchar" in qualifiers:
|
||||
nastring=qualifiers[b"commentchar"][0][0]
|
||||
commentchar=qualifiers[b"commentchar"][0][0]
|
||||
else:
|
||||
nastring=config["obi"]["commentchar"]
|
||||
commentchar=config["obi"]["commentchar"]
|
||||
|
||||
if format is not None:
|
||||
if qualifiers[b"seqtype"]==b"nuc":
|
||||
objclass = Nuc_Seq
|
||||
if format="fasta":
|
||||
if format==b"fasta":
|
||||
iseq = fastaNucIterator(file,skip,only)
|
||||
elif format="fastq":
|
||||
elif format==b"fastq":
|
||||
iseq = fastqIterator(file,
|
||||
skip,only,
|
||||
offset,
|
||||
@ -309,7 +308,7 @@ def open_uri(uri,input=True,config={}):
|
||||
elif qualifiers[b"seqtype"]==b"prot":
|
||||
raise NotImplementedError()
|
||||
else:
|
||||
iseq,objclass = entryIterator(file,
|
||||
iseq,objclass = entryIteratorFactory(file,
|
||||
skip,only,
|
||||
seqtype,
|
||||
offset,
|
||||
|
Reference in New Issue
Block a user