meffil icon indicating copy to clipboard operation
meffil copied to clipboard

meffil.qc.summary Error and Warning

Open roxUCL opened this issue 1 year ago • 4 comments

Hi all, I have recently experiend the following error using meffil.qc.summary on EPICv2 array

qc.summary <- meffil.qc.summary(qc.objects,verbose=TRUE) [meffil.qc.summary] Fri Dec 15 14:04:36 2023 Sex summary TRUE [meffil.qc.summary] Fri Dec 15 14:04:36 2023 Meth vs unmeth summary Error in if (any(dat$outliers)) p1 <- p1 + geom_point(data = subset(dat, : missing value where TRUE/FALSE needed

In addition: Warning message: The <scale> argument of guides() cannot be FALSE. Use "none" instead as of ggplot2 3.3.4. ℹ The deprecated feature was likely used in the meffil package. Please report the issue to the authors. This warning is displayed once every 8 hours. Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.

Any help would be very appreciated.

Thank you

roxUCL avatar Dec 15 '23 14:12 roxUCL

Sorry to hear about this error. Could you run the following code and send me the output generated?

    outlier.sd <- 3
    dat <- data.frame(
        sample.name = sapply(qc.objects, function(x) x$sample.name),
        methylated = sapply(qc.objects, function(x) x$median.m.signal),
        unmethylated = sapply(qc.objects, function(x) x$median.u.signal),
        stringsAsFactors=F
    )

    fit <- lm(methylated ~ unmethylated, dat)
    dat$resids <- residuals(fit)
    dat$methylated.lm <- predict(fit)
    interval.size <- outlier.sd*sd(dat$resids)
  
    dat$upper.lm <- dat$methylated.lm + interval.size
    dat$lower.lm <- dat$methylated.lm - interval.size

    dat$outliers <- (dat$resids > mean(dat$resids) + interval.size
                     | dat$resids < mean(dat$resids) - interval.size)
   
   na.idx <- which(is.na(dat$outliers))
   cat(nrow(dat), length(na.idx), "\n")
  if (na.idx > 3) na.idx <- na.idx[1:3]
   print(dat[na.idx,])

perishky avatar Dec 20 '23 13:12 perishky

Hi, thanks for your help.

Here is the output

`cat(nrow(dat), length(na.idx), "\n") 1 1

if (na.idx > 3) na.idx <- na.idx[1:3] print(dat[na.idx,]) sample.name methylated unmethylated resids 206891110004_R01C01 206891110004_R01C01 2621.36 2521.409 0 methylated.lm upper.lm lower.lm outliers 206891110004_R01C01 2621.36 NA NA NA`

Thanks in advances,

Rossella

roxUCL avatar Dec 20 '23 14:12 roxUCL

Ah I see. The qc.summary() is failing when it attempts to identify outliers because only one sample is being analysed. Although some quality information can be generated for a single sample, variation between samples is necessary to evaluate technical variation. Do you have more samples? Will you regularly need a QC procedure to apply to individual samples?

perishky avatar Dec 20 '23 16:12 perishky

Thank you so much for your support. That was the issue. To replay to your question no I will run QC onbatches of samples, and the tested with multiples samples worked perfectly. Thanks again

roxUCL avatar Dec 20 '23 18:12 roxUCL