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

Functional normalization for EPIC data #15

Open schmic05 opened 3 years ago

schmic05 commented 3 years ago

Functional normalization is currently only supported for the 450k array (see lines 417-447 in normalization.R). We should check whether this is also possible for the EPIC array.

plamy commented 3 years ago

I tested the nanes normalization directly using the code from wateRmelon (for EPIC arrays) and it worked without any issues. I suspect most of these functions should work. I do not know if it works directly (if wateRmelon tests for 450k status).

ann<-annotation(rnb.set.raw, add.names=TRUE)
Mmatrix<-M(rnb.set.raw, row.names=TRUE)
Umatrix<-U(rnb.set.raw, row.names=TRUE)

db1 <-
function(mn, un ){
   stopifnot(dim(un) == dim(mn))
   a <- dim(un)[2]
   mun <- normalizeQuantiles(cbind(mn,un))
   mnn <- mun[,1:a]
   unn <- mun[,(a+1):(2*a)]
   list(mnn,unn)
}

mns=Mmatrix
uns=Umatrix
onetwo=ann[,"Design"]
fudge = 100

mns[onetwo=='I' ,] <- normalizeQuantiles(mns[onetwo=='I', ])
uns[onetwo=='I' ,] <- normalizeQuantiles(uns[onetwo=='I', ])

a <- db1(mns[onetwo=='II',], uns[onetwo=='II',])

beta <- mns/(mns + uns + fudge)
list(methylated=mns,unmethylated=uns,beta=beta)