hNAD define
NAD$ratio = 0
for(i in 1:dim(NAD)[1]){
print(i)
write.table(NAD[i,],'/lustre/user/liclab/pengt/projects/nucleus/new/NAD/t',
row.names = F,quote = F,col.names = F,sep='\t')
system('/lustre/user/liclab/software/anaconda3/bin/bedtools intersect -wa -b /lustre/user/liclab/pengt/projects/nucleus/new/NAD/t -a /lustre/user/liclab/pengt/projects/nucleus/new/NAD/nhic_all.bedgraph>/lustre/user/liclab/pengt/projects/nucleus/new/NAD/tt')
t = read.table('./tt')
t=max(t$V4)
NAD[i,4] = t
}
NAD$fc = 2^(NAD$ratio)
NAD$length = NAD$V3 - NAD$V2
length = c()
for(i in seq(0.5,6,by=0.5)){
print(i)
length = c(length,dim(NAD[NAD$ratio>i,])[1])
}
library(ggplot2)
ggplot(data = data.frame(log2FC_cutoff = seq(0.5,6,by=0.5),NAD_length=length), aes(x =log2FC_cutoff, y = NAD_length)) +
geom_point(color = 'red',size= 5) + theme_classic()+
theme(text = element_text(size = 20),legend.position = "none")
write.table(NAD[NAD$ratio>1,1:3],'/lustre/user/liclab/pengt/projects/nucleus/new/NAD/hNAD',row.names=F,col.names=F,quote = F,sep = '\t')