mani2012 / BatchQC

Provides Quality Control of sequencing samples by deducing if there is batch effect and adjusts for it.
34 stars 23 forks source link

Error in if (spvaltext2 == 0) { : missing value where TRUE/FALSE needed #23

Open LefterisZ opened 3 years ago

LefterisZ commented 3 years ago

Hi,

I have been trying to make BatchQC work for the past two days to no avail. I keep getting the below error:

  Quitting from lines 256-274 (batchqc_report.Rmd) 
  Error in if (spvaltext2 == 0) { : missing value where TRUE/FALSE needed

Having a closer look the problem seemed to appear in lines 263-264:

pval <- batchQC_shapeVariation(lcounts_adj, batch, plot = TRUE, groupCol = 
     rainbow(nlevels(bf))[bf])

Inside the _batchQCshapeVariation function, I tried to narrow down the problem to see where it occurs. My findings were that in line 34 (_batchps <- batchEffectPvalue(gnormdata, sortgroups, robust=robustGene)) the function batchEffectPvalue returns the below:

 batch_ps      Named num [1:4] 0 0 NaN NaN

These two NaNs are producing the problem since the NaN in the if (spvaltext2 == 0) { cannot give TRUE or FALSE.

Inside the function batchEffectPvalue everything seems to run smoothly until we reach the

  skewbatch <- unlist(lapply(1:length(batch2), function(x) apply(data[,batch2[[x]]], 1, skewness)))
  kurtbatch <- unlist(lapply(1:length(batch2), function(x) apply(data[,batch2[[x]]], 1, kurtosis)))

By having a look at the skewbatch and kurtbatch objects I saw that there are some NaNs present. I believe that this is causing the problem downstream.

Now, I don't know whether this is a problem of skewness and kurtosis functions or is a problem with my data. I tried both raw counts and quantile normalized read counts (as suggested by you). I also filtered the quantile normalized counts for low standard deviation and made sure that none of my batches contain genes with only zeroes (as suggested in your website). I don't know what else I can do. I even thought of adding a 0 in the _report_optionbinary option to skip the creation of this graph but I am not sure about that since I might be leaving out an important part of the batchQC analysis.

Can you please help me?

Best regards, Lefteris

PhD candidate, Newcastle University, UK

mani2012 commented 3 years ago

Hi,

It is most likely an issue with your data. It could also be that your batch condition are confounded. Why don’t you first get it running by adding a 0 in the report_option_binary option to skip the creation of this graph, and check out the rest of the analysis and you may be able to locate the problem with your data.

Best, Mani

From: LefterisZ @.> Sent: Friday, October 1, 2021 12:12 PM To: mani2012/BatchQC @.> Cc: Subscribed @.***> Subject: [mani2012/BatchQC] Error in if (spvaltext2 == 0) { : missing value where TRUE/FALSE needed (#23)

Hi,

I have been trying to make BatchQC work for the past two days to no avail. I keep getting the below error:

**_Quitting from lines 256-274 (batchqc_report.Rmd)

Error in if (spvaltext2 == 0) { : missing value where TRUE/FALSE needed_**

Having a closer look the problem seemed to appear in lines 263-264:

_pval <- batchQC_shapeVariation(lcounts_adj, batch, plot = TRUE, groupCol =

 rainbow(nlevels(bf))[bf])_

Inside the batchQC_shapeVariation function, I tried to narrow down the problem to see where it occurs. My findings were that in line 34 (batch_ps <- batchEffectPvalue(gnormdata, sortgroups, robust=robustGene)) the function batchEffectPvalue returns the below:

batch_ps Named num [1:4] 0 0 NaN NaN

These two NaNs are producing the problem since the NaN in the if (spvaltext2 == 0) { cannot give TRUE or FALSE.

Inside the function batchEffectPvalue everything seems to run smoothly until we reach the

skewbatch <- unlist(lapply(1:length(batch2), function(x) apply(data[,batch2[[x]]], 1, skewness)))

kurtbatch <- unlist(lapply(1:length(batch2), function(x) apply(data[,batch2[[x]]], 1, kurtosis)))

By having a look at the skewbatch and kurtbatch objects I saw that there are some NaNs present. I believe that this is causing the problem downstream.

Now, I don't know whether this is a problem of skewness and kurtosis functions or is a problem with my data. I tried both raw counts and quantile normalized read counts (as suggested by you). I also filtered the quantile normalized counts for low standard deviation and made sure that none of my batches contain genes with only zeroes (as suggested in your website). I don't know what else I can do. I even thought of adding a 0 in the report_option_binary option to skip the creation of this graph but I am not sure about that since I might be leaving out an important part of the batchQC analysis.

Can you please help me?

Best regards, Lefteris

PhD candidate, Newcastle University, UK

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mani2012/BatchQC/issues/23, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACMB4PBJQWJXRAB3LGZV27TUEXMVDANCNFSM5FFA3HQQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.