I am attempting to normalize my ChIPseq data with offsets and loess normalization as they appear to display trended bias and I want to visualise the effects of the normalization with the MA plot. I have generated the consensus peaks and the count object, which I then applied the dba.contrast() function, and subsequently dba.analyze(). I basically followed the steps on page 45 of the Diffbind documentation. https://bioconductor.org/packages/release/bioc/vignettes/DiffBind/inst/doc/DiffBind.pdf
However, I keep getting errors on "Blacklist error: Error: Invalid normalization" and "Unable to apply Blacklist/Greylist." despite removing the unwanted blacklists before hand. I also tried not removing blacklists beforehand and the code still didnt work.
Does anyone have any idea what could be causing the error and how I can fix it?
And if there is any recommendations or scripts of runnning successful offset and loess normalization?
Thank you!
library(DiffBind)
library(edgeR)
library(tidyverse)
library(dplyr)
samples <- read.csv('Sample.csv')
# create a dba object which contains the peaksets of the samples
dbObj <-dba(sampleSheet = samples)
dbObj
# ========= Obtain consensus peaks ===========
# Get the peakset for tumor and normal
tumor_normal_peaks <- dba.peakset(dbObj,
consensus=DBA_FACTOR,
minOverlap = 2)
tumor_normal_overlap <- dba(tumor_normal_peaks,
mask=tumor_normal_peaks$masks$Consensus,
minOverlap = 2)
consensus_peaks <- dba.peakset(tumor_normal_overlap,
bRetrieve = TRUE)
consensus_peaks
# ============ Affinity binding analysis ================
# Extract the tumor-normal overlap peaks from the peaksets of each individual sample
tumor_normal_count_loess <- dba.count(dbObj,
peaks=consensus_peaks, #specify the peak source. Peaks retrieved from tumor_normal_overlap
bUseSummarizeOverlaps = TRUE)
# Remove unwanted blacklists
tumor_normal_count_loess_blacklisted <-dba.blacklist(tumor_normal_count_loess, blacklist = DBA_BLACKLIST_HG38, greylist = FALSE)
# ============ Loess fit Normalisation ==================
tumor_normal_count_loess_blacklisted$config$AnalysisMethod <- DBA_EDGER
tumor_normal_count_loess_blacklisted$config$AnalysisMethod
tumor_normal_normalized_loess_blacklisted <- dba.normalize(tumor_normal_count_loess_blacklisted,
offsets = TRUE)
norm <- dba.normalize(tumor_normal_normalized_loess_blacklisted,
bRetrieve = TRUE)
norm
# ============ Modeling and contrast ================
tumor_normal_contrasted_loess_blacklisted <- dba.contrast(tumor_normal_normalized_loess_blacklisted,
categories=DBA_FACTOR,
design = "~ Factor",
contrast = c("Factor", "Tumor", "Normal"),
minMembers = 2)
tumor_normal_contrasted_loess_blacklisted
# ============ Differential analysis =================
tumor_normal_analyzed_loess_blacklisted <- dba.analyze(tumor_normal_contrasted_loess_blacklisted)
output
> tumor_normal_analyzed_loess <- dba.analyze(tumor_normal_contrasted_loess_blacklisted)
Applying Blacklist/Greylists...
Genome detected: Hsapiens.UCSC.hg38
Counting control reads for greylist...
rsession-arm64(44993) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(44994) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(44995) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(44996) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(44997) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(44998) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45008) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45007) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45011) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45009) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45012) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45010) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45137) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
Building greylist: /Volumes/T7ShieldSSD/hcc_h3k4me3/data/bam_k4/HEP152_1_INP.bam
rsession-arm64(45531) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45532) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45533) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45534) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45535) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45536) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45537) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45538) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
coverage: 5124608 bp (0.17%)
Building greylist: /Volumes/T7ShieldSSD/hcc_h3k4me3/data/bam_k4/HEP152_3_INP.bam
rsession-arm64(45569) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45570) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45571) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45572) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45573) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45574) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45575) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45576) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
coverage: 5351936 bp (0.17%)
Building greylist: /Volumes/T7ShieldSSD/hcc_h3k4me3/data/bam_k4/HEP152_4_INP.bam
rsession-arm64(45582) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45583) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45584) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45585) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45586) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45587) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45588) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45589) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
coverage: 5366784 bp (0.17%)
Building greylist: /Volumes/T7ShieldSSD/hcc_h3k4me3/data/bam_k4/HEP262T2B_IN.bam
rsession-arm64(45595) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45596) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45597) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45598) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45599) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45600) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45601) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45602) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
coverage: 4605439 bp (0.15%)
Building greylist: /Volumes/T7ShieldSSD/hcc_h3k4me3/data/bam_k4/HEP268N_INP.bam
rsession-arm64(45609) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45610) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45611) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45612) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45613) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45614) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45615) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45616) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
coverage: 5565951 bp (0.18%)
Building greylist: /Volumes/T7ShieldSSD/hcc_h3k4me3/data/bam_k4/HEP276N_INP.bam
rsession-arm64(45621) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45622) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45623) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45624) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45625) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45626) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45627) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
rsession-arm64(45628) MallocStackLogging: can't turn off malloc stack logging because it was not enabled.
coverage: 4783616 bp (0.15%)
Control1: 428 ranges, 5124608 bases
Control2: 380 ranges, 5351936 bases
Control3: 376 ranges, 5366784 bases
Control4: 439 ranges, 4605439 bases
Control5: 387 ranges, 5565951 bases
Control6: 390 ranges, 4783616 bases
Master greylist: 780 ranges, 8692223 bases
Removed: 78 of 11422 intervals.
Re-normalizing...
Blacklist error: Error: Invalid normalization
Unable to apply Blacklist/Greylist.
Thanks for your help Rory!
I've removed the blacklist and greylist first and it works now.