Skip to content

Commit

Permalink
Do not modify .fa/.fq extensions and add flush to GzipBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Roderick Bovee authored and boydgreenfield committed Jan 5, 2017
1 parent 0ec23d8 commit 6d06c44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions onecodex/lib/inline_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ def __len__(self):
def write(self, s):
self._reads_buffer.write(s)
if len(self._reads_buffer) >= self.MAX_READS_BUFFER_SIZE:
self._gzip.write(self._reads_buffer.read())
self.flush()

def read(self, size=-1):
return self._buf.read(size)

def flush(self):
pass
self._gzip.write(self._reads_buffer.read())

def close(self):
if len(self._reads_buffer) > 0:
self._gzip.write(self._reads_buffer.read())
self.flush()
self._gzip.close()


Expand Down
9 changes: 2 additions & 7 deletions onecodex/lib/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,13 @@ def _file_stats(filename):
if ext in {'.gz', '.gzip', '.bz', '.bz2', '.bzip'}:
new_filename, ext = os.path.splitext(new_filename)

if ext in {'.fa', '.fna', '.fasta'}:
ext = '.fa'
elif ext in {'.fq', '.fastq'}:
ext = '.fq'

return new_filename + ext + '.gz', file_size


def _wrap_files(filename, logger=None):
"""
A little helper to wrap a sequencing file (or join and wrap R1/R2 pairs) and return
a merged file_object and a "new" filename for the output
A little helper to wrap a sequencing file (or join and wrap R1/R2 pairs)
and return a merged file_object
"""
if isinstance(filename, tuple):
file_obj = FASTXTranslator(open(filename[0], 'rb'), pair=open(filename[1], 'rb'),
Expand Down

0 comments on commit 6d06c44

Please sign in to comment.