convert bam to bigwig using deepTools by feeding inverse of DESeq’s size Factor

You can read the details laid out by ATpoint about how to use a scale factor with deepTools. He specified it for ATAC-seq/ChIP-seq, but the principles are the same for RNA-seq: calculate a scaling factor with DESeq2 and supply the inverse (!) to bamCoverage –scaleFactor.

https://www.biostars.org/p/317023/

https://hbctraining.github.io/DGE_workshop/lessons/02_DGE_count_normalization.html

## get sizeFactors from created DESeq2Dataset object
dds <- estimateSizeFactors(dds)
sizeFactors(dds)
normalized_counts <- counts(dds, normalized=TRUE)
write.table(normalized_counts, file=”data/normalized_counts.txt”, sep=”\t”, quote=F, col.names=NA)

bamCoverage –bam ${sample}Aligned.sortedByCoord.out.bam -o ../bigWigs/${sample}_norm.bw –binSize 10 –scaleFactor 1/0.5695507 –effectiveGenomeSize 2864785220

bamCoverage –bam a.bam -o a.SeqDepthNorm.bw \
–binSize 10
–normalizeUsing RPGC
–effectiveGenomeSize 2150570000
–ignoreForNormalization chrX
–extendReads

Sure, you can use the DESeq2 scale factor. I don’t recall whether DESeq2 is dividing by the scale factor or multiplying by it. If it’s doing the latter then you don’t need to invert (just compare a normalized and raw count in DESeq2 to be sure).

–skipNonCoveredRegions –binSize 10 –scaleFactor 1/DESeq’s size factor”.

#https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM3941356
BamCoverage from deepTools (version 3.0.2) was used to generate bigwig tracks with parameters “–skipNonCoveredRegions –binSize 10 –scaleFactor 1/DESeq’s size Factor”.

Leave a Reply

Your email address will not be published. Required fields are marked *