methylKit
methylKit copied to clipboard
Fisher-test option for adjust.methylC
This is a feature request against the development version, which contains an adjust.methylC feature that does subtraction of an oxBS and mkBS (mock-BS or BS sample). See the code below.
With this optional Fisher-test filtering, those entries where the 4 counts don't pass the t test with a given threshold are excluded, and the rest of entries are included. One could leave the default of not using fisher-test filtering as it is now.
fisher.test(matrix(c(mkBS_methylated, mkBS_unmethylated, oxBS_methylated, oxBS_unmethylated),nrow=2,dimnames=list(mkBS=c("methylated","unmethylated"),oxBS=c("methylated","unmethylated"))))
setMethod("adjust.methylC", c("methylRaw","methylRaw"),function(mc,hmc){
lst=new("methylRawList",list(mc,hmc),treatment=c(1,0))
data=getData(unite(lst))
diff=(data$numCs1)-round(data$coverage1*(data$numCs2/data$coverage2))
diff[diff<0]=0
data$numCs1=diff
data$numTs1=data$coverage1-data$numCs1
colnames(data)[5:7]=c("coverage","numCs","numTs")
new("methylRaw",data[,1:7],[email protected], assembly=mc@assembly,
context =mc@context, resolution=mc@resolution)
})
Where is the t-test applied here in the code? Do you have a reference where a similar filtering method applied ?
The paper from Booth et al (http://www.sciencemag.org/content/336/6083/934/suppl/DC1) used the Fishers-Exact test to measure the detectability of 5hmC at a single cytosine position at different coverage levels (Figure S15) and correlates this confidence to coverage level. A False Discovery Rate (FDR) correction filter can also be applied using Benjamini-Hochberg test.
Ok, but where is the t-test ?
On Friday, 29 January 2016, Russell Hamilton [email protected] wrote:
The paper from Booth et al ( http://www.sciencemag.org/content/336/6083/934/suppl/DC1) used the Fishers-Exact test to measure the detectability of 5hmC at a single cytosine position at different coverage levels (Figure S15) and correlates this confidence to coverage level. A False Discovery Rate (FDR) correction filter can also be applied using Benjamini-Hochberg test.
— Reply to this email directly or view it on GitHub https://github.com/al2na/methylKit/issues/26#issuecomment-176678418.
Sent from mobile, excuse the brevity
There is no t-test - the Fishers-Exact test is the correct one to use
Apologies, I wrongly wrote t-test in the description but then copied the fisher.test line of code. Corrected now.
This can already be done with existing functions, it would be more convenient to have it in adjust.methylC() function but until that happens (eta unknown). you can first treat hmc and mc samples as as mc samples use unite() and calculateDiffMeth() to get fisher's exact test values, get the coordinates that passes the test, then filter adjust.methylC results based on those coordinates