Skip to content

Commit

Permalink
Fix: getCumulative R method optimized (#1659)
Browse files Browse the repository at this point in the history
Co-authored-by: Jordi Camps Puchades <[email protected]>
Co-authored-by: Jessica Way <[email protected]>
  • Loading branch information
3 people authored Apr 14, 2021
1 parent e88573f commit 959411f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/main/resources/picard/analysis/insertSizeHistogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ for (i in 1:length(startFinder)) {
}

getCumulative <- function(y, yrange) {
yNew <- rep(0, nrow(y));
yLength <- nrow(y)
ySum <- sum(y[,1])
for (i in 1:yLength) {
yNew[i] <- (yrange * sum(as.numeric(y[i:yLength,1])) / ySum)
}
return (yNew)
return ((yrange / sum(y[,1])) * rev(cumsum(rev(y[,1]))))
}

histogram <- read.table(metricsFile, header=TRUE, sep="\t", skip=secondBlankLine, comment.char="", quote='', check.names=FALSE)
Expand Down

0 comments on commit 959411f

Please sign in to comment.