Commit 8278b2bc by Eric Coissac

Patch the index to be able to deal with sequence entries only

constituted by N
parent 5eaa2b32
......@@ -159,7 +159,7 @@ def allopen(filename):
try:
f = urlopen(filename)
except:
f = open(filename)
f = open(filename,newline=None)
return f
......@@ -216,7 +216,7 @@ def readFasta(filename):
if seqid > 0:
seq = ''.join(seq)
yield (sid,bytes(seq,encoding='latin1'))
sid = line[1:].split(' ',1)[0].rsplit('/',1)[0].strip()
sid = line[1:].split(None,1)[0].rsplit('/',1)[0].strip()
seqid+=1
seq=[]
else:
......@@ -240,7 +240,7 @@ def readFastq(filename):
if seqid > 0:
seq = ''.join(seq)
yield (sid,bytes(seq,encoding='ascii'))
sid = line[1:].split(' ',1)[0].rsplit('/',1)[0].strip()
sid = line[1:].split(None,1)[0].rsplit('/',1)[0].strip()
seqid+=1
lseq = 0
seq=[]
......@@ -272,11 +272,19 @@ def lengthStats(seqs):
def seqIterator():
for s in store:
yield (s[0],zlib.decompress(s[1]))
# print(s)
if s[1] is not None:
yield (s[0],zlib.decompress(s[1]))
else:
yield (s[0],b'')
def reader():
for s in seqs:
store.append((s[0],zlib.compress(s[1])))
# print(s)
if len(s[1]):
store.append((s[0],zlib.compress(s[1])))
else:
store.append((s[0],None))
yield len(s[1])
stats = Counter(reader())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment