Skip to content

Commit

Permalink
Merge pull request #225 from Pandapip1/filter-error-messages
Browse files Browse the repository at this point in the history
Add helpful error messages to read_fastx.py
  • Loading branch information
Cengoni authored May 22, 2024
2 parents 70c308a + cefbad8 commit efd1d04
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion metaphlan/utils/read_fastx.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ def read_and_write_raw_int(fd, min_len=None, prefix_id=""):
# avg_read_length = len(l) + avg_read_length
# _ = sys.stdout.write(ignore_spaces(l))

if not idx:
sys.stderr.write('Error: no reads found.\n')
sys.exit(1)

nreads = idx - discarded

if not nreads:
nreads, avg_read_length = 0, 0
sys.stderr.write('Error: no reads longer than {} bp found.\n'.format(min_len))
sys.exit(1)

return (nreads, avg_read_length)

Expand Down

0 comments on commit efd1d04

Please sign in to comment.