Skip to content

Commit

Permalink
Updated fastq_umi_merge.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ppericard committed Mar 29, 2024
1 parent 3bf8d4e commit 0641be8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions bin/fastq_umi_merge.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import argparse
import gzip

Expand Down Expand Up @@ -33,19 +32,19 @@ def parse_fastq(fastq_filehandle):
"""
line_number = 0
for line in fastq_filehandle:
l = line.strip()
stripped_line = line.strip()
if isinstance(line, bytes): # Handle binary mode for gzip
l = l.decode("utf-8")
if l:
stripped_line = stripped_line.decode("utf-8")
if stripped_line:
line_number += 1
if line_number % 4 == 1:
read_header = l[1:]
read_header = stripped_line[1:]
elif line_number % 4 == 2:
read_seq = l
read_seq = stripped_line
elif line_number % 4 == 3:
continue # Skip the '+' line
elif line_number % 4 == 0:
read_qual = l
read_qual = stripped_line
yield (read_header, read_seq, read_qual)


Expand Down

0 comments on commit 0641be8

Please sign in to comment.