I have a problem when I use BSmooth to smooth the data with bsseq package. I used read.bismark to import the data into R and the data have been successfully imported. Here is the code.
library(bsseq)
bis <- read.bismark(c("BS1_F_R1.cov",
"BS2_F_R1.cov",
"BS3_F_R1.cov",
"BS1_R_R1.cov",
"BS2_R_R1.cov",
"BS3_R_R1.cov",
"BS1_P_R1.cov",
"BS2_P_R1.cov",
"BS3_P_R1.cov"),
c("F1","F2","F3",
"R1","R2","R3",
"P1","P2","P3"),
rmZeroCov = FALSE,
strandCollapse = FALSE,
fileType = (c("cov")),
verbose = TRUE)
bis.fit <- BSmooth(bis, mc.cores = 3)
Error in integer(lw[3]) : invalid 'length' argument
Error in numeric(lw[2]) : invalid 'length' argument
*** caught segfault ***
address 0x7f10aaa5ecf8, cause 'memory not mapped'
Traceback:
1: .C("slocfit", x = as.numeric(x), y = as.numeric(rep(y, length.out = n)), cens = as.numeric(rep(cens, length.out = n)), w = as.numeric(rep(weights, length.out = n)), base = as.numeric(rep(base, length.out = n)), lim = as.numeric(c(xl, fl)), mi = as.integer(size$mi), dp = as.numeric(size$dp), strings = c(kern, family, link, itype, acri, kt), scale = as.numeric(scale), xev = if (ev$type == "pres") as.numeric(xev) else numeric(d * nvc[1]), wdes = numeric(lw[1]), wtre = numeric(lw[2]), wpc = numeric(lw[4]), nvc = as.integer(size$nvc), iwk1 = integer(lw[3]), iwk2 = integer(lw[7]), lw = as.integer(lw), mg = as.integer(ev$mg), L = numeric(lw[5]), kap = numeric(lw[6]), deriv = as.integer(deriv), nd = as.integer(length(deriv)), sty = as.integer(style), basis = list(basis, lfbas), PACKAGE = "locfit")
2: lfproc(x, y, weights = weights, cens = cens, base = base, geth = geth, ...)
3: locfit(M ~ lp(pos, nn = nn, h = h), data = sdata, weights = Cov, family = "binomial", maxk = 10000)
4: smooth(idxes = jj, sampleIdx = sIdx)
5: doTryCatch(return(expr), name, parentenv, handler)
6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
7: tryCatchList(expr, classes, parentenv, handlers)
8: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
9: try(smooth(idxes = jj, sampleIdx = sIdx))
10: FUN(X[[i]], ...)
11: lapply(clusterIdx, function(jj) { try(smooth(idxes = jj, sampleIdx = sIdx))})
12: lapply(clusterIdx, function(jj) { try(smooth(idxes = jj, sampleIdx = sIdx))})
13: FUN(X[[i]], ...)
14: eval(expr, env)
15: doTryCatch(return(expr), name, parentenv, handler)
16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
17: tryCatchList(expr, classes, parentenv, handlers)
18: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
19: try(eval(expr, env), silent = TRUE)
20: sendMaster(try(eval(expr, env), silent = TRUE))
21: mcparallel(FUN(X[[i]], ...), mc.set.seed = mc.set.seed, silent = mc.silent)
22: FUN(X[[i]], ...)
23: lapply(jobid, function(i) mcparallel(FUN(X[[i]], ...), mc.set.seed = mc.set.seed, silent = mc.silent))
24: mclapply(seq(along = sampleNames), function(sIdx) { ptime1 <- proc.time() tmp <- lapply(clusterIdx, function(jj) { try(smooth(idxes = jj, sampleIdx = sIdx)) }) coef <- do.call(c, lapply(tmp, function(xx) xx$coef)) se.coef <- do.call(c, lapply(tmp, function(xx) xx$se.coef)) ptime2 <- proc.time() stime <- (ptime2 - ptime1)[3] if (verbose) { cat(sprintf("[BSmooth] sample %s (out of %d), done in %.1f sec\n", sampleNames[sIdx], length(sampleNames), stime)) } return(list(coef = coef, se.coef = se.coef))}, mc.preschedule = mc.preschedule, mc.cores = mc.cores)
25: BSmoothbis.nz)
An irrecoverable exception occurred. R is aborting now ...
Error: Could not construct DelayedMatrix from 'coef'
Any help would be appreciated!