DESeq2 normalization when using with derfinder

Hi,
I have a question about whether I should set the sizeFactors to 1 prior to using DESeq2 on the counts obtained from derfinder. I have normalized bigwig files ( using deepTools ), which I use as input to derfinder. Following the instructions in the users guide : lcolladotor.github.io/derfinder/articles/derfinder-users-guide.html#expressed-regions-level-1
My doubt is that if the counts obtained by derfinder are already from normalized bigwig files, whether I should set the sizeFactors to 1 before running the DESeq function.

Thank you,
Debayan

Code should be placed in three backticks as shown below


# include your problematic code here with any corresponding output 
# please also include the results of running the following in an R session 

## Determine the files to use and fix the names
files_RZ <- list.files(path="C:/Users/rnaseq_RZ/", pattern=".*bw$",full.names=T)

names(files_RZ) <- gsub(".deepTools.bw", "", basename(files_RZ))

## Load the data from disk -- On Windows you have to load data from Bam files
chrs=paste("chr",c(1:22,"X","Y","M"),sep="")
fullCov_RZ <- fullCoverage(files = files_RZ, chrs=chrs, verbose = FALSE)

## Get the region matrix of Expressed Regions (ERs)
regionMat_RZ <- regionMatrix(fullCov_RZ, cutoff = 30, L = 100, verbose = FALSE)

# Combine into a single one

## First extract the data
regs <- unlist(GRangesList(lapply(regionMat_RZ, '[[', 'regions')))
covMat <- do.call(rbind, lapply(regionMat_RZ, '[[', 'coverageMatrix'))
## Force the names to match
names(regs) <- rownames(covMat) <- seq_len(length(regs))
## Combine into a list (not really needed)
mergedRegionMat_RZ <- list('regions' = regs, 'coverageMatrix' = covMat)

## Round matrix
counts_RZ <- round(mergedRegionMat_RZ$coverageMatrix)

##Design
coldata=data.frame(factor(c("1","2","2","2","1","1","2","1","3","3","3","3")))

colnames(coldata)="condition"
rownames(coldata)=colnames(counts_RZ)

dds_RZ <- DESeqDataSetFromMatrix(countData = counts_RZ,
                              colData = coldata,
                              design = ~ condition)

dds2_RZ <- DESeq(dds_RZ)


sessionInfo( )
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] reshape2_1.4.4              forcats_0.5.0               purrr_0.3.4                
 [4] readr_1.4.0                 tidyr_1.1.2                 tidyverse_1.3.0            
 [7] derfinder_1.24.2            ggrepel_0.8.2               DESeq2_1.30.0              
[10] SummarizedExperiment_1.20.0 Biobase_2.50.0              MatrixGenerics_1.2.0       
[13] matrixStats_0.57.0          GenomicRanges_1.42.0        GenomeInfoDb_1.26.2        
[16] IRanges_2.24.0              S4Vectors_0.28.1            BiocGenerics_0.36.0        
[19] leaflet_2.0.4.1             stringr_1.4.0               dplyr_1.0.2                
[22] ggplot2_3.3.3               tibble_3.0.4                RColorBrewer_1.1-2         
[25] shiny_1.6.0                

loaded via a namespace (and not attached):
  [1] readxl_1.3.1             backports_1.2.0          Hmisc_4.5-0              BiocFileCache_1.14.0    
  [5] plyr_1.8.6               lazyeval_0.2.2           sp_1.4-5                 splines_4.0.3           
  [9] BiocParallel_1.24.1      crosstalk_1.1.1          digest_0.6.27            foreach_1.5.1           
 [13] ensembldb_2.14.1         htmltools_0.5.1.1        viridis_0.5.1            leaflet.providers_1.9.0 
 [17] magrittr_2.0.1           checkmate_2.0.0          memoise_2.0.0            BSgenome_1.58.0         
 [21] cluster_2.1.0            Biostrings_2.58.0        annotate_1.68.0          modelr_0.1.8            
 [25] askpass_1.1              prettyunits_1.1.1        jpeg_0.1-8.1             colorspace_2.0-0        
 [29] rvest_0.3.6              blob_1.2.1               rappdirs_0.3.1           haven_2.3.1             
 [33] xfun_0.25                crayon_1.3.4             RCurl_1.98-1.2           jsonlite_1.7.1          
 [37] genefilter_1.72.0        survival_3.2-7           VariantAnnotation_1.36.0 iterators_1.0.13        
 [41] glue_1.4.2               gtable_0.3.0             zlibbioc_1.36.0          XVector_0.30.0          
 [45] DelayedArray_0.16.0      scales_1.1.1             DBI_1.1.0                rngtools_1.5            
 [49] derfinderHelper_1.24.1   Rcpp_1.0.5               viridisLite_0.3.0        xtable_1.8-4            
 [53] progress_1.2.2           htmlTable_2.2.1          bumphunter_1.32.0        foreign_0.8-80          
 [57] bit_4.0.4                Formula_1.2-4            htmlwidgets_1.5.3        httr_1.4.2              
 [61] ellipsis_0.3.1           pkgconfig_2.0.3          XML_3.99-0.5             farver_2.0.3            
 [65] nnet_7.3-14              sass_0.4.0               dbplyr_2.0.0             locfit_1.5-9.4          
 [69] tidyselect_1.1.0         labeling_0.4.2           rlang_0.4.11             later_1.2.0             
 [73] AnnotationDbi_1.52.0     cellranger_1.1.0         munsell_0.5.0            tools_4.0.3             
 [77] cachem_1.0.5             cli_3.0.1                generics_0.1.0           RSQLite_2.2.1           
 [81] broom_0.7.6              fastmap_1.1.0            yaml_2.2.1               fs_1.5.0                
 [85] knitr_1.33               bit64_4.0.5              AnnotationFilter_1.14.0  doRNG_1.8.2             
 [89] mime_0.9                 xml2_1.3.2               biomaRt_2.46.0           compiler_4.0.3          
 [93] rstudioapi_0.13          curl_4.3                 png_0.1-7                reprex_0.3.0            
 [97] geneplotter_1.68.0       bslib_0.2.5.1            stringi_1.5.3            GenomicFeatures_1.42.1  
[101] GenomicFiles_1.26.0      lattice_0.20-41          ProtGenerics_1.22.0      Matrix_1.2-18           
[105] vctrs_0.3.5              pillar_1.4.7             lifecycle_1.0.0          jquerylib_0.1.4         
[109] data.table_1.13.4        bitops_1.0-6             raster_3.4-13            qvalue_2.22.0           
[113] httpuv_1.6.1             rtracklayer_1.49.5       R6_2.5.0                 latticeExtra_0.6-29     
[117] promises_1.2.0.1         gridExtra_2.3            codetools_0.2-16         assertthat_0.2.1        
[121] openssl_1.4.3            withr_2.4.2              GenomicAlignments_1.26.0 Rsamtools_2.6.0         
[125] GenomeInfoDbData_1.2.4   hms_0.5.3                grid_4.0.3               rpart_4.1-15            
[129] lubridate_1.7.9.2        base64enc_0.1-3          tinytex_0.33

Read more here: Source link