Question: bsseq BSmooth error
0
3.1 years ago by
enricoferrero570
Switzerland
enricoferrero570 wrote:

Hi,

I'm getting this error when using the BSmooth function in bsseq:

covs <- list.files(indir, pattern="\\.bismark.cov$", full.names=TRUE, recursive=TRUE) bsobj <- read.bismark(files=covs, sampleNames=names(covs), fileType="cov") fit <- BSmooth(bsobj, mc.cores=ncores, parallelBy="sample", verbose=TRUE) [BSmooth] preprocessing ... done in 101.7 sec [BSmooth] smoothing by 'sample' (mc.cores = 16, mc.preschedule = FALSE) Error in sum(sapply(res, inherits, "try-error")) : invalid 'type' (list) of argument traceback() 6: 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)
5: BSmooth(bsobj, mc.cores = ncores, parallelBy = "sample", verbose = TRUE) at 07differentialMethylation.R#30
4: eval(expr, envir, enclos)
3: eval(ei, envir)
2: withVisible(eval(ei, envir))
1: source("07differentialMethylation.R", echo = TRUE)

However I can't reproduce this with the BS.cancer.ex data.

Do you have any idea about what might be causing that error?

I'm using R 3.2.2, Bioconductor 3.2 and bsseq 1.6.0

Thank you,

Enrico

bsseq • 834 views
written 3.1 years ago by enricoferrero570

It seems to be related to an old bug in mclapply() that occurs when the number of operations (17 samples in this case) is higher than the number of cores (I'm using 16):

However this should have been fixed years ago.

Any idea?

Thanks,

Enrico

1

If this is the cause of the error, shouldn't you be able to reproduce it using the cancer dataset?

I suggest trying to make the BSseq object small (say 10k CpGs), and if you can reproduce the error, send it (the small object_ to me.

Kasper

BS.cancer.ex is only 6 samples, which is less than the number of cores I'm using (16).

I'll try out your suggestion and let you know how it goes.

Thank you!