Browse code

Fixing #42, need to recalculate index for matching runValue

Robert Ivánek authored on 14/03/2021 21:52:31
Showing 1 changed files

... ...
@@ -1072,7 +1072,10 @@ setMethod("collapseTrack", signature(GdObject = "DataTrack"), function(GdObject,
1072 1072
                     newDat,
1073 1073
                     do.call(rbind, lapply(2:nrow(sc), function(x) {
1074 1074
                         rm[ind] <- rep(sc[x, ], width(GdObject))
1075
-                        suppressWarnings(runValue(runmean(Rle(as.numeric(rm)), k = windowSize, endrule = "constant", na.rm = TRUE)))[seqSel]
1075
+                        runwin <- suppressWarnings(runmean(Rle(as.numeric(rm)), k = windowSize, endrule = "constant", na.rm = TRUE))
1076
+                        seqSel <- findRun(as.integer(position(GdObject)) - min(GdObject) + 1, runwin)
1077
+                        runValue(runwin)[seqSel]
1078
+                        # suppressWarnings(runValue(runmean(Rle(as.numeric(rm)), k = windowSize, endrule = "constant", na.rm = TRUE)))[seqSel]
1076 1079
                     }))
1077 1080
                 )
1078 1081
             }