epigen / RnBeads

Git working Repo synced to the Bioconductor: http://bioconductor.org/packages/devel/bioc/html/RnBeads.html
https://rnbeads.org/
7 stars 8 forks source link

Error in differential variability with paired setup #37

Closed alex-d13 closed 1 year ago

alex-d13 commented 1 year ago

Hi,

I wanted to try the differential variability feature using diffVar in RnBeads. I have a paired experiment between two groups.

However, I am running into the following error message:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'var': incorrect number of dimensions

I checked the source code of RnBeads and I am pretty sure that its due to this line of code: https://github.com/epigen/RnBeads/blob/99cf51e5a3e137aacb0d328e7790ddf7f286d72c/R/differentialVariability.R#L1285 I think the part has to be changed to something like this, so that the log ratio is calculated correctly for each row in the table X:

var.log.ratio <- apply(X,1,function(x){
  var((x[inds.g1]+eps)/(x[inds.g2]+eps))
})

Also, I am not sure how the eps variable is initialized in RnBeads, maybe I missed it. Otherwise that could be added as well..

If you want, I could open a small pull request; I am not sure how you would like to handle minor things like this :)

Cheers, Alex

schmic05 commented 1 year ago

Hi Alex,

Thanks for reporting this and for spotting the issue!

I fixed the issue with commit f6f3e71. It will take some time until the update propagates to the Bioconductor release version, so you can either install the development version of Bioconductor, or use the current version from here:

devtools::install_github(epigen/'RnBeads')

Let me know if this solved the issue or if you have further problems!

Best,

Michael

alex-d13 commented 1 year ago

Works now :) Thanks for the quick fix.