Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meffil.qc.summary Error and Warning #56

Open
roxUCL opened this issue Dec 15, 2023 · 4 comments
Open

meffil.qc.summary Error and Warning #56

roxUCL opened this issue Dec 15, 2023 · 4 comments

Comments

@roxUCL
Copy link

roxUCL commented Dec 15, 2023

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

@perishky
Copy link
Owner

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,])

@roxUCL
Copy link
Author

roxUCL commented Dec 20, 2023

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

@perishky
Copy link
Owner

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?

@roxUCL
Copy link
Author

roxUCL commented Dec 20, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants