2015-7-10-001-code

From ZhangLabWiki
Jump to navigation Jump to search
# shared high HDRC regions based on normal samples
setwd("/home/sguo/methylation")
file=list.files(pattern="*mh.cor.RData")
load(file[i])
cancer=substr(file[1],1,4)
edge=0.6
newcor<-cor[which(cor[,2]>edge),]
bed1<-cor2bed(rownames(newcor))
print(nrow(bed1))
number<-c()
region<-c(rownames(newcor))
for(i in 2:length(file)){
 load(file[i])
 cancer=substr(file[i],1,4)
 newcor<-cor[which(cor[,2]>edge),]
 bed2<-cor2bed(rownames(newcor))
 bed1<-Rbedtools(functionstring="intersectBed",bed1,bed2,opt.string="-wa")
 ntmp<-c(nrow(bed1),nrow(bed2))
 number<-c(number,nrow(bed1))
 region<-c(region,rownames(newcor))
}
regionx1<-unique(region)
regionx2<-cor2bed(regionx1)
write.table(regionx1,file="conservative.methylation.block.0.6.normal.cor",sep="\t",col.names=F,row.names=F,quote=F)
write.table(regionx2,file="conservative.methylation.block.0.6.normal.bed",sep="\t",col.names=F,row.names=F,quote=F)
write.table(bed1,file="conservative.methylation.block.C11.0.6.normal.bed",sep="\t",col.names=F,row.names=F,quote=F)