From 3ce1c5c6bdbbff22fac91fe14f931fdd71aab8a7 Mon Sep 17 00:00:00 2001 From: "ycl6.gel@gmail.com" <9032946+ycl6@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:03:59 +0100 Subject: [PATCH] Cast objects to numeric type to handle large integers --- R/errorModels.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/errorModels.R b/R/errorModels.R index 2d19b9e..44a54b3 100644 --- a/R/errorModels.R +++ b/R/errorModels.R @@ -258,8 +258,8 @@ learnErrors <- function(fls, nbases=1e8, nreads=NULL, errorEstimationFunction = } else { drps[[i]] <- derepFastq(fls[[i]], qualityType = qualityType) } - NREADS <- NREADS + sum(drps[[i]]$uniques) - NBASES <- NBASES + sum(drps[[i]]$uniques * nchar(names(drps[[i]]$uniques))) + NREADS <- NREADS + sum(as.numeric(drps[[i]]$uniques)) + NBASES <- NBASES + sum(as.numeric(drps[[i]]$uniques) * as.numeric(nchar(names(drps[[i]]$uniques)))) if(is.null(nreads) && NBASES > nbases) { break } if(!is.null(nreads) && NREADS > nreads) { break } } @@ -372,7 +372,7 @@ inflateErr <- function(err, inflation, inflateSelfTransitions = FALSE) { ## accumulateTrans <- function(trans) { maxcol <- max(sapply(trans, ncol)) - rval <- matrix(0L, nrow=16, ncol=maxcol) + rval <- matrix(0, nrow=16, ncol=maxcol) rownames(rval) <- c("A2A", "A2C", "A2G", "A2T", "C2A", "C2C", "C2G", "C2T", "G2A", "G2C", "G2G", "G2T", "T2A", "T2C", "T2G", "T2T") colnames(rval) <- seq(0, maxcol-1) # One col for each integer starting at 0 for(tt in trans) {