Skip to content

Commit

Permalink
Fix bug with reverse mapping indices in reduce operation (#78).
Browse files Browse the repository at this point in the history
Also update relevant tests
  • Loading branch information
jkanche authored Apr 12, 2024
1 parent d20ec60 commit 7d2105b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/genomicranges/GenomicRanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ def reduce(
_rev_map = []
for j in res_ir._mcols.get_column("revmap"):
_rev_map.append([_oindices[x] for x in j])
rev_map.extend(_rev_map[0] * len(res_ir))
rev_map.extend(_rev_map)

all_merged_ranges = ut.combine_sequences(*all_grp_ranges)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_gr_inter_range_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_reduce_with_gapwidth_with_reverse_map():
assert (out.start == np.array([101, 104, 102, 105, 103])).all()
assert (out.width == np.array([11, 30, 21, 5, 25])).all()
assert (out.strand == np.array([0, 1, -1, -1, 0])).all()
assert out.mcols.column("revmap") == [0, 3, 1, 4, 2]
assert out.mcols.column("revmap") == [[0], [3], [1], [4], [2]]


def test_range():
Expand Down

0 comments on commit 7d2105b

Please sign in to comment.