From b46cb42dfb8750329ba27b3391da9078b913c6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Baraa=20Orabi=20/bara=CB=90=CA=94=20=CA=95ra=CB=90bi/?= Date: Tue, 21 Mar 2023 11:27:53 -0700 Subject: [PATCH] Fix off by 1 error; avoid crash if a strand has no reads --- scTagger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scTagger.py b/scTagger.py index 13f1c54..7b9cf1f 100755 --- a/scTagger.py +++ b/scTagger.py @@ -119,7 +119,7 @@ def parse_args(): s, e = -e, -s + 1 else: assert False, (strand) - for i in np.arange(s, e): + for i in np.arange(s, e+1): assert not i in ranges_dicts[ranges_idx], ( ranges_idx, i, ranges_dicts[ranges_idx]) ranges_dicts[ranges_idx][i] = len(ranges[ranges_idx]) @@ -198,6 +198,8 @@ def get_alns(seq): def get_ranges(data): ranges = list() + if len(data) == 0: + return ranges min_l = min(data) max_l = max(data) L = np.arange(min_l, max_l+1)