DiffBind - Comparing normalization/background methods - how to create a heatmap (as in 7.5)?
Hello,
I have a RNAPII ChIPseq dataset (one condition: wild-type and mutant) that I have analyzed in DiffBind in several ways that include:
- Normalizing to read depth or background reads
- Targeting narrow peaks, broad peaks, and open reading frames
- 3 replicates & just 2 replicates (1 replicate looks like an outlier)
With these 12 different analyses, I would like to create a heatmap that compares these different strategies just as R. Stark and G. Brown did in 7.5 of the DiffBind manual.
Can anybody provide advice on how I might go about plotting this information to compare upregulated/downregulated/no change genes across these analyses?
Thanks in advance! B
• 2,297 views
•
link
1 answer
The code that generates the data object dbs.all used in the figures for Section 7.5 of the DiffBind vignette can be viewed in the vignette source file. I'll copy the code chunk here:
data(tamoxifen_analysis)
dbs.all <- NULL
for(norm in c("lib","RLE","TMM", "loess")) {
for(libsize in c("full","RiP","background")) {
tam <- NULL
background <- offsets <- FALSE
if(libsize == "full" && norm != "lib") {
background <- NULL
}
if(libsize == DBA_LIBSIZE_BACKGROUND) {
background <- TRUE
if(norm == DBA_NORM_LIB) {
background <- NULL
}
}
if(norm == "loess" && !is.null(background)) {
offsets <- TRUE
if(libsize != "background") {
background <- FALSE
} else {
background <- NULL
}
}
if(!is.null(background)) {
tam <- dba.normalize(tamoxifen, method=DBA_ALL_METHODS,
normalize=norm, library=libsize,
background=background, offsets=offsets)
}
if(!is.null(tam)) {
tam <- dba.analyze(tam, method=DBA_ALL_METHODS)
for(meth in DBA_ALL_METHODS) {
db <- dba.report(tam, method=meth, bDB=TRUE)
if(meth == DBA_EDGER) {
methstr <- "edgeR"
} else {
methstr <- "DESeq2"
}
if(libsize == "background") {
libstr <- "BG"
} else {
libstr <- libsize
}
id <- paste(norm,libstr,methstr,sep="_")
if(libsize == "full") {
libstr <- "BG"
}
if(is.null(dbs.all)) {
dbs.all <- db
dbs.all$config$factor <- "Normalization Method"
dbs.all$config$condition <- "Reference Reads"
dbs.all$config$treatment <- "Analysis Method"
dbs.all$class[DBA_ID,] <- colnames(dbs.all$class)[1] <- id
dbs.all$class[DBA_FACTOR,] <- norm
dbs.all$class[DBA_CONDITION,] <- libstr
dbs.all$class[DBA_TREATMENT,] <- "edgeR"
dbs.all$class[DBA_TISSUE,] <- NA
} else {
db$class[DBA_ID,] <- id
db$class[DBA_FACTOR,] <- norm
db$class[DBA_CONDITION,] <- libstr
db$class[DBA_TREATMENT,] <- methstr
db$class[DBA_TISSUE,] <- NA
dbs.all <- dba.peakset(dbs.all,db)
}
}
}
}
}
dbs.all <- dba(dbs.all,minOverlap=1)
dbs.all
• 0 views
•
link
Log in to answer this question.