TransBioInfoLab/coMethDMR

`CoMethAllRegions()` returns invisibly

Opened this issue · 7 comments

We have an example where there are no comethylated regions for a subset of the probes of interest. When we save the output, it saves as NULL; However, when I run the function without saving the output, nothing is printed to the console. The function should return NULL regardless, and perhaps even print a message that no regions of concurrent methylation were found.

I was testing a small subset (about 500) close-by gene regions for J. Jones' EPIC methylation data (n = 33 controls).

Ok, so the issue is something else. I just tested all 49k regions and got back NULL after 3 hours of computing. There is something seriously wrong. Even if there is an issue in the data, we should have an error at the start of the CoMethAllRegions() call before people spend literal hours of computing time.
I'm digging in now

I figured it out: I'm using a tibble to store the data, which just hates row names. We need a check to confirm that some of the rownames are contained in the list of CpGs; perhaps with

sum(rownames(dnam) %in% unlist(CpGs_ls))

Also, (and I need to make this another issue), the lmmTest() functions can't handle the output from GetResiduals() because these functions assume that the methylation values are betas. The transformation to M values is hard coded. I either need to have GetResiduals() return logit-transformed residuals (in the beta scale), or add a switch to the lmmTest() functions if the "betas" are actually M-values already.

Also, when lmmTestAllRegions() hits an error, the log file doesn't close. You have to close RStudio to finish writing to the file.

More lmmTestAllRegions() stuff: when you don't want to include a covariate, you have to set covariates_char = NULL; using covariates_char = "" will not error, but the statistics and p-values will all be NA.

This NULL trick works in serial, but not in parallel?

Warning in parallel::mccollect(wait = FALSE, timeout = 1) :
  1 parallel job did not deliver a result
Error in env[[as.character(i)]] <- value : 
  wrong args for environment subassignment