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.

## get sizeFactors from created DESeq2Dataset object
dds <- estimateSizeFactors(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} –binSize 10 –scaleFactor 1/0.5695507 –effectiveGenomeSize 2864785220

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

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”.

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 *