zwdzwd / sesame

🍪 SEnsible Step-wise Analysis of DNA MEthylation BeadChips
Other
63 stars 33 forks source link

Problem in readIDATpair when including controls #105

Open oliemery opened 1 year ago

oliemery commented 1 year ago

Hello, First of all, before describing my issue, I would like to thank you for this amazing package. Here's my problem: using the readIDATpair function works to import a pair of idats when not providing the "controls" argument. However when including it, I get the following error:

Error in data.frame(Probe_ID = mft1$Probe_ID, MG = unname(tmpM[, "G"]),  : 
  arguments imply differing number of rows : 0, 1

For information, my code using the controls argument used to work with a (much) earlier version of SeSaMe (1.8.2, now I'm on 1.19.5). Looking at the source code of sesame.R I believe the problem is that I don't have any "Infinium I" (or type I) controls in my controls file. They are all type II (the Illumina full manifest for EPIC v1 gives controls separately with only one address per control so I deduce from this that they are all type II). I believe the error is due to the chipAddressToSignal function which does not ignore the case where there are no type I probes, resulting in an empty data.frame for type I probes and subsequent error causing the program to exit. Manually converting in my controls data.frame one type II probe to type I with green color and a second type II probe to type I with red color does not cause the error anymore (but I have to make up some A address and color for both which obviously is not a viable scientific solution). I saw that you do check that you don't have an empty data.frame with type II probes with

 if (nrow(mft2) > 0) {
        tmp <- dm[match(mft2$U, rownames(dm)),]
        [...]

Maybe you could do something similar with type I probes to check that mft1 does have some rows in order to fix this? Thanks in advance for your help with this issue

All the best