Hello, Dr Stark. Recently, I am learning some knowlege about coordinate system of zero based and one based. And It reminds me that I often do some format change in DiffBind :). Just like
1. change the merged coordinate into bed format
dba_meta <- dba(minOverlap = 1, sampleSheet = sample_info)
> dba_meta$merged[1:10,]
CHR START END
1 1 30 875
2 1 1392 1953
3 1 2164 3625
4 1 8268 8966
5 1 13654 14698
6 1 16512 16931
7 1 20391 21655
8 1 22671 23272
9 1 33104 33997
10 1 37785 38663
merge_peak <- as.data.frame(dba_meta$merged)
merge_peak$CHR <- gsub("(\\d+)","Chr\\1",merge_peak$CHR,perl = T)
merge_peak$name <- paste0("WFX_peak_",1:dim(merge_peak)[1])
merge_peak$scores <- "."
merge_peak$strands <- "."
write.table(format(merge_peak,scientific=FALSE),
file = "result/processed_result/merge_peak.bed",
quote = F,sep = "\t",
row.names = F,col.names = F,
)
2. And annote dba_report ouput using ChIPseeker::AnnotatePeak
dba_report_all <- dba.report(dba_diff,th = 1)
peakAnno <- annotatePeak(dba_report_all,
TxDb = TxDb.Athaliana.BioMart.plantsmart28,
level = "gene")
I noticed the DiffBind will first merge the Peakset from samples and change into GRange, But I not sure the dba_meta$merged
is 0-based or 1-based. I do find the start of dba_meta$merged
is the same as the start of dba_report GRange
, So the output of Diffbind is all 1-based?
Sorry to bother you. Best wishes
Guandong Shang
Thanks for your reply! MACS2 produced peak is 0-based while the GRange is 1-based. But
the start and end
indba_meta$merged
is the same as the GRange start and end indba_report
. So the 0-1 transformed occurs in the narrowPeak -> dba_meta$merged?