hansenlab / minfi

Devel repository for minfi
60 stars 70 forks source link

Error with bumphunter during p-value estimation #238

Open alex-d13 opened 2 years ago

alex-d13 commented 2 years ago

Hi,

I wanted to use minfi to find differentially methylated regions in my dataset, but i am stuck with the following error:

dmrs_condition <- bumphunter(GRset.quantile, design = design, pickCutoff = TRUE, pickCutoffQ = .95, B=1, type="Beta", nullMethod = 'bootstrap')
[bumphunterEngine] Parallelizing using 12 workers/cores (backend: doParallelMC, version: 1.0.16).
[bumphunterEngine] Computing coefficients.
[bumphunterEngine] Performing 1 bootstraps.
Loading required package: rngtools
[bumphunterEngine] Computing marginal bootstrap p-values.
[bumphunterEngine] cutoff: 0.011
[bumphunterEngine] Finding regions.
[bumphunterEngine] Found 421197 bumps.
[bumphunterEngine] Computing regions for each bootstrap.
[bumphunterEngine] Estimating p-values and FWER.
Error in `$<-.data.frame`(`*tmp*`, "p.valueArea", value = c(result.1 = 0,  : 
  replacement has 12 rows, data has 421197
In addition: Warning messages:
1: In foreach(bootstraps = iter(bootIndexes, by = "column", chunksize = chunksize),  :
  Foreach loop (doParallelMC) had changed the current RNG type: RNG was restored to same type, next state
2: In foreach(subMat = iter(permBeta, by = "col", chunksize = chunksize),  :
  Foreach loop (doParallelMC) had changed the current RNG type: RNG was restored to same type, next state
3: In cbind(...) :
  number of rows of result is not a multiple of vector length (arg 2)

Does anyone has some clues what might be going on here?

alex-d13 commented 2 years ago

I found the solution: I had a variable in my R environment called x which apparently is used in this line https://github.com/rafalab/bumphunter/blob/aabc3c86771d108d7bdc18988b2f04ed66dabe6f/R/bumphunter.R#L279 over the x from sapply. I dont know if this is an issue with foreach, but whoever has the same error, simply remove the x object from your R environment with rm(x) and you should be fine.