Skip to content

Commit

Permalink
Handle spaces in seq id
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulthran committed Jun 15, 2023
1 parent fe797bb commit f88d99e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions workflow/scripts/filter_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ def write_log(f: TextIOWrapper, hostdict: OrderedDict, host: int, nonhost: int):
with gzip.open(snakemake.input.reads, "rt") as f_in, gzip.open(snakemake.output.reads, "wt") as f_out, open(snakemake.input.hostreads) as f_ids:
ids = {k.strip(): 1 for k in f_ids.readlines()}
for header_str, seq_str, plus_str, quality_str in parse_fastq(f_in):
if not header_str in ids and not header_str.replace("/1", "").replace("/2", "") in ids:
if not header_str.split(" ")[0] in ids and not header_str.replace("/1", "").replace("/2", "") in ids:
write_fastq([header_str, seq_str, plus_str, quality_str], f_out)
print(f"{header_str}: {list(ids.keys())[0]}")
sys.exit()

with open(snakemake.output.log, "w") as log:
write_log(log, hostdict, host, nonhost)
Expand Down

0 comments on commit f88d99e

Please sign in to comment.