From 9bcf0c5e66d0c0e5eccbe5deacc40bd8cac37508 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Thu, 11 Apr 2024 19:17:44 -0700 Subject: [PATCH 1/2] Fix reverse mapping --- src/genomicranges/GenomicRanges.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/genomicranges/GenomicRanges.py b/src/genomicranges/GenomicRanges.py index 6627da0..2d03bec 100644 --- a/src/genomicranges/GenomicRanges.py +++ b/src/genomicranges/GenomicRanges.py @@ -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) From 338838601f95ec6cbef3a77e8b0dd3e6775d7184 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Thu, 11 Apr 2024 19:20:39 -0700 Subject: [PATCH 2/2] update tests --- tests/test_gr_inter_range_methods.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_gr_inter_range_methods.py b/tests/test_gr_inter_range_methods.py index efbfcc7..86ef757 100644 --- a/tests/test_gr_inter_range_methods.py +++ b/tests/test_gr_inter_range_methods.py @@ -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():