Browse code

Fix bug in `combine()` that merged adjacent loci

- Cannot use `union()` as that calls `reduce()` with `min.gapwidth = 1L`, which leads to adjacent (unstranded) loci being combined into a locus with width == 2.
- Re-ran `inst/scripts/get_BS.chr22.R` to update the included data, `BS.chr22`

Peter Hickey authored on 11/06/2018 14:12:03
Showing 2 changed files

... ...
@@ -122,7 +122,11 @@ combineList <- function(x, ..., BACKEND = NULL) {
122 122
     stopifnot(isTRUE(all(x_has_same_parameters)))
123 123
     # Check if all inputs have the same set of loci
124 124
     x_rowRanges <- lapply(x, rowRanges)
125
-    ans_rowRanges <- Reduce(union, x_rowRanges)
125
+    ans_rowRanges <- Reduce(
126
+        f = function(x, y) {
127
+            reduce(c(x, y), drop.empty.ranges = TRUE, min.gapwidth = 0L)
128
+        },
129
+        x = x_rowRanges)
126 130
     intersect_rowRanges <- Reduce(intersect, x_rowRanges)
127 131
     all_x_have_same_loci <- identical(ans_rowRanges, intersect_rowRanges)
128 132
     # Check if safe to combine smoothed representations (coef and se.coef).
129 133
Binary files a/data/BS.chr22.rda and b/data/BS.chr22.rda differ