Browse code

Fix ylims issue. Closing #46.

Robert Ivánek authored on 07/04/2022 08:23:13
Showing 1 changed files

... ...
@@ -556,8 +556,9 @@ setReplaceMethod("feature", signature("DataTrack", "character"), function(GdObje
556 556
         )
557 557
     } else {
558 558
         if (is.function(agFun)) {
559
+            # na.rm currently not implemented...
559 560
             function(x, k, na.rm = FALSE, endrule = "constant") {
560
-                ans <- vapply(0:(length(x) - k), function(offset) agFun(x[seq_len(k) + offset], na.rm = na.rm), FUN.VALUE = numeric(1))
561
+                ans <- vapply(0:(length(x) - k), function(offset) agFun(x[seq_len(k) + offset]), FUN.VALUE = numeric(1))
561 562
                 ans <- Rle(ans)
562 563
                 if (endrule == "constant") {
563 564
                     j <- (k + 1L) %/% 2L
... ...
@@ -965,7 +966,7 @@ setMethod("drawGD", signature("DataTrack"), function(GdObject, minBase, maxBase,
965 966
                 valsS <- if (ncol(vals)) {
966 967
                     do.call(cbind, lapply(
967 968
                         split(vals, groups),
968
-                        function(x) agFun(t(matrix(x, ncol = ncol(vals))))
969
+                        function(x) t(matrix(x, ncol = ncol(vals)))
969 970
                     ))
970 971
                 } else {
971 972
                     matrix(nrow = nlevels(groups), ncol = 0, dimnames = list(levels(groups)))
... ...
@@ -993,7 +994,7 @@ setMethod("drawGD", signature("DataTrack"), function(GdObject, minBase, maxBase,
993 994
                 }
994 995
             } else {
995 996
                 if (is.null(ylim)) {
996
-                    valsA <- agFun(t(vals))
997
+                     valsA <- t(vals)
997 998
                     ylim <- if (!length(valsA)) c(-1, 1) else c(min(c(0, valsA), na.rm = TRUE), max(valsA, na.rm = TRUE))
998 999
                     if (length(type) > 1) {
999 1000
                         ylim <- range(c(ylim, vals), na.rm = TRUE)
... ...
@@ -1294,8 +1295,7 @@ setMethod("drawGD", signature("DataTrack"), function(GdObject, minBase, maxBase,
1294 1295
                 }
1295 1296
             }
1296 1297
         } else {
1297
-            agFun <- .aggregator(GdObject)
1298
-            valsS <- agFun(t(vals))
1298
+            valsS <- t(vals)
1299 1299
             grid.rect(start(GdObject), yy,
1300 1300
                 width = width(GdObject), height = valsS - yy,
1301 1301
                 gp = gpar(col = pcols$col.histogram, fill = pcols$fill.histogram, lwd = pcols$lwd[1], lty = pcols$lty[1], alpha = alpha), default.units = "native",