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