methylKit icon indicating copy to clipboard operation
methylKit copied to clipboard

Error in calculateDiffMeth with dispersion=MN

Open alynn1993 opened this issue 3 years ago • 1 comments

Hi, I am able to run calculateDiffMeth on my dataset when dispersion='none', but get the following error when dispersion='MN': two groups detected: will calculate methylation difference as the difference of treatment (group: 1) - control (group: 0) Error in if (is.na(p.value)) { : argument is of length zero Calls: calculateDiffMeth ... .calculateDiffMeth -> simplify2array -> mclapply -> lapply -> FUN

Based on the calculateDiffMeth source code perhaps adding isTRUE to the if(is.na(p.value))) in the following could help:

do F-test when overdispersion >1 given test=ifelse(test=="F" & phi>1,"F","Chisq")

p.value=switch(test, F={ pf(deviance/phi, ddf, (length(w)-nprm), lower.tail = FALSE)
}, Chisq={ pchisq(deviance/phi, 1, lower.tail = FALSE) }) if(is.na(p.value)) { warning("Replacing NaN with 1.") p.value <- 1 }

alynn1993 avatar Aug 30 '22 18:08 alynn1993

Hi @alynn1993,

Thanks for reporting this error. Could you please send a minimal reproducible example to help us debug the problem?

Best, Alex

alexg9010 avatar Aug 30 '22 18:08 alexg9010