My goal is to make PCA and correlation plots of my RNA-Seq BAM files.  Some useful discussion on BioStars such as [this][1], have helped guide my steps.

In another post, responding to a question on library size normalization at this BioStars [post][2], user [ATpoint][3] indicates size factor calculation must be performed as follows:

    ## edgeR:: calcNormFactors
    tmp.NormFactors <- calcNormFactors(object = raw.counts, method = c("TMM"), doWeighting = FALSE)
    
    ## raw library size:
    tmp.LibSize <- colSums(raw.counts)
    
    ## calculate size factors:
    SizeFactors <- tmp.NormFactors * tmp.LibSize / 1000000

In my analyses, I used `DESeq2` instead of `edgeR`, after importing SALMON quantification using tximport, using syntax instructions at [BioConductor][4], as follows:

    library(DESeq2)
    Design <- DataFrame((cbind(BiolRep, Genotype, TimePoints)))
    dim(Design)
    #[1] 144   3
    rownames(Design) <- colnames(txi.salmon$counts)
    design_formula <- ~ TimePoints * Genotype
    
    dds <- DESeqDataSetFromTximport(txi.salmon, Design.df, design_formula)
    NormValues <- estimateSizeFactorsForMatrix(counts(dds))

So my **1st question** is this:

To use DESeq2-based size Factors for converting BAM to BigWig, using bamCoverage of deepTools, I would still need to calculate `SizeFactors` as follows, rather than use just the (inverse of the) `NormValues`, am I right?

    SizeFactors <- NormValues * LibSize / 1000000

And my **2nd question** is :

With `SizeFactors` calculated as above, I'd then have to use the **inverse of those values** to obtain my final **normalized BAM files** as inputs for use with deepTools, with the following syntax, am I right?

    bamCoverage -b $BAM_IN -o $BigWig_OUT --normalizeUsing None --scaleFactor $(1/Size_factor) --effectiveGenomeSize $ACGTtotalCount


Could you please confirm or correct the approach I have indicated above? Thanks in advance!


  [1]: http://%20https://www.biostars.org/p/349881/
  [2]: https://bioconductor.riken.jp/packages/3.4/bioc/vignettes/tximport/inst/doc/tximport.html
  [3]: https://www.biostars.org/u/25721/
  [4]: https://bioconductor.riken.jp/packages/3.4/bioc/vignettes/tximport/inst/doc/tximport.html
Please use `1/calcNormFactors(object = raw.count)` as the scaling factor. Whether you use TMM or the default RLE is largely immaterial to me.  Your `bamCoverage` command looks fine.