Skip to content

Commit 1c63dda

Browse files
author
Johannes
committed
fixed edge case in shift augmentation
1 parent 9ffeb8b commit 1c63dda

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

enformer_pytorch/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def __call__(self, chr_name, start, end, return_augs = False):
116116
min_shift, max_shift = self.shift_augs
117117
max_shift += 1
118118

119-
min_shift = max(start + min_shift, 0) - start
120-
max_shift = min(end + max_shift, chromosome_length) - end
119+
min_shift = min(max(start + min_shift, 0) - start, 0)
120+
max_shift = max(min(end + max_shift, chromosome_length) - end, 1)
121121

122122
rand_shift = randrange(min_shift, max_shift)
123123
start += rand_shift

0 commit comments

Comments
 (0)