Skip to content

Commit b46cb42

Browse files
authored
Fix off by 1 error; avoid crash if a strand has no reads
1 parent 1e009cd commit b46cb42

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

scTagger.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def parse_args():
119119
s, e = -e, -s + 1
120120
else:
121121
assert False, (strand)
122-
for i in np.arange(s, e):
122+
for i in np.arange(s, e+1):
123123
assert not i in ranges_dicts[ranges_idx], (
124124
ranges_idx, i, ranges_dicts[ranges_idx])
125125
ranges_dicts[ranges_idx][i] = len(ranges[ranges_idx])
@@ -198,6 +198,8 @@ def get_alns(seq):
198198

199199
def get_ranges(data):
200200
ranges = list()
201+
if len(data) == 0:
202+
return ranges
201203
min_l = min(data)
202204
max_l = max(data)
203205
L = np.arange(min_l, max_l+1)

0 commit comments

Comments
 (0)