Question: bsseq BSmooth error
gravatar for enricoferrero
3.0 years ago by
enricoferrero570 wrote:


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
6: mclapply(seq(along = sampleNames), function(sIdx) {
       ptime1 <- proc.time()
       tmp <- lapply(clusterIdx, function(jj) {
           try(smooth(idxes = jj, sampleIdx = sIdx))
       coef <-, lapply(tmp, function(xx) xx$coef))
       se.coef <-, 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,


bsseq • 797 views
ADD COMMENTlink written 3.0 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?



ADD REPLYlink written 3.0 years ago by enricoferrero570

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.


ADD REPLYlink written 3.0 years ago by Kasper Daniel Hansen6.4k

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! 

ADD REPLYlink written 3.0 years ago by enricoferrero570
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 197 users visited in the last hour