From cefbad85aa35e34df9daba88a6fad75f167ee630 Mon Sep 17 00:00:00 2001 From: Gavin John <> Date: Thu, 16 May 2024 13:36:21 -0500 Subject: [PATCH] Add helpful error messages to read_fastx.py --- metaphlan/utils/read_fastx.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/metaphlan/utils/read_fastx.py b/metaphlan/utils/read_fastx.py index 5adb3dc..fd47e6f 100755 --- a/metaphlan/utils/read_fastx.py +++ b/metaphlan/utils/read_fastx.py @@ -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)