#hierarchical hypothesis testing approach # 08.08.2016 # Author : Wei Hung Pan # import library # https://bioconductor.org/packages/release/bioc/html/DSS.html library(DSS) #import data; 5 Germ free vs 5 conventional BS_list<-list(); k<-rep(NA,10) For (i in 1:10){ k[i]<-paste0(“sample”,i,”.txt”) BS_list[[i]]<-read.table(k, header=T) } BSobj <- makeBSseqData( BS_list, k ) #run differential methylation test on single position dmlTest <- DMLtest(BSobj, group1=k[1:5], group2=k[6:10]) # find differential methylation region DMR<- callDMR(dmlTest, delta= 0.2, p.threshold=0.1, minlen=200) #extract the methylation sites within the differential methylation region for( i in DMR$chr){ Regi<-subset(DMR, chr==i) DML<-subset(dmlTest, chr==i) InDMR<-rep(0,dim(DML)[2]) for (j in 1:dim(Regi)[2]){ for(k in 1:dim(DML)[2]){ InDMR[i]=1 } } if(i ==“chr1”){ DML_inR<-DML[which(InDMR==1),] } else{ DML_inR<-rbind(DML_inR,DML[which(InDMR==1)) } } #calculate the FDR based on the selected ones FDR_new<-adj.pvalue(DML$pval) #the final list after multiple correction Final_DML<-DML[which(FDR_new<0.05)] #export the data frame Write.table(Final_DML, “final_list.txt”)