Question: different statiscal results in DESeq2 from the same samples
gravatar for Mehmet Ilyas Cosacak
5 months ago by
Germany/Dresden/ CRTD - DZNE
Mehmet Ilyas Cosacak0 wrote:


On 02.01.2017, I ran an analysis with DESeq2. I ran a similar analysis recently. I used the same input data for both runs! Please see "raw reads" in the excel file ( Even tough the normalized reads and basemean are same in both runs, the log2FoldChange, padj, etc are completely different. Moreover, I think there are two bugs:

In the previous one ( I do not have a session info for that, ran on 02.01.2017), for "gene21828" the log2FoldChange is calculated wrongly!

In the new one; for "gene23073","gene8822", the log2FoldChange is calculated wrongly or in another words: even though the reads number are blow 30 reads, the log2FoldChange and padj values are calculated as significantly expressed genes. (see gene8822).

Especially the number of DE genes in the new run is over 600 genes [abs(log2FoldChange) >= 1.0]. In the previous one [abs(log2FoldChange) >= 1.0], it is around 30 genes. 20 fold differences in the number of DE genes!

I could not find anything that I may doing wrong, that is why I am posting.

p.s. : I have a pipeline for RNASeq data analysis that is why there are several packages, such as goseq, GOStats, topGO,  ...



> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
 [1]            xtable_1.8-2                  WriteXLS_4.0.0                stringr_1.2.0                
 [5] statmod_1.4.30                scales_0.5.0                  splitstackshape_1.4.2         Rgraphviz_2.20.0             
 [9] reshape2_1.4.2                topGO_2.28.0                  SparseM_1.77                  ReportingTools_2.16.0        
[13] knitr_1.17                    RColorBrewer_1.1-2            png_0.1-7                     plotrix_3.6-6                
[17] PerformanceAnalytics_1.4.3541 xts_0.10-0                    zoo_1.8-0                     pathview_1.16.5              
[21]            pheatmap_1.0.8                  LSD_3.0                      
[25] KEGGREST_1.16.1               KEGG.db_3.2.3                 GSEABase_1.38.1               gdata_2.18.0                 
[29] gplots_3.0.1                  GOstats_2.42.0                graph_1.54.0                  Category_2.42.1              
[33] Matrix_1.2-10                 goseq_1.28.0                  BiasedUrn_1.07                GO.db_3.4.1                  
[37] ggrepel_0.6.5                 ggplot2_2.2.1                 GenomicFeatures_1.28.4        geneplotter_1.54.0           
[41] annotate_1.54.0               XML_3.98-1.9                  lattice_0.20-35               geneLenDataBase_1.12.0       
[45] genefilter_1.58.1             fdrtool_1.2.15                edgeR_3.18.1                  limma_3.32.5                 
[49] dtplyr_0.0.2                  plyr_1.8.4                    DESeq2_1.16.1                 SummarizedExperiment_1.6.3   
[53] DelayedArray_0.2.7            matrixStats_0.52.2            GenomicRanges_1.28.4          GenomeInfoDb_1.12.2          
[57] data.table_1.10.4             calibrate_1.7.2               MASS_7.3-47                   biomaRt_2.32.1               
[61] BiocParallel_1.10.1           AnnotationForge_1.18.2        AnnotationDbi_1.38.2          IRanges_2.10.3               
[65] S4Vectors_0.14.3              Biobase_2.36.2                BiocGenerics_0.22.0           BiocInstaller_1.26.1         

loaded via a namespace (and not attached):
 [1] backports_1.1.0               Hmisc_4.0-3                   AnnotationHub_2.8.2           lazyeval_0.2.0               
 [5] splines_3.4.1                 digest_0.6.12                 ensembldb_2.0.4               htmltools_0.3.6              
 [9] magrittr_1.5                  checkmate_1.8.3               memoise_1.1.0                 BSgenome_1.44.1              
[13] cluster_2.0.6                 Biostrings_2.44.2             R.utils_2.5.0                 ggbio_1.24.1                 
[17] colorspace_1.3-2              blob_1.1.0                    dplyr_0.7.2                   RCurl_1.95-4.8               
[21] bindr_0.1                     survival_2.41-3               VariantAnnotation_1.22.3      glue_1.1.1                   
[25] gtable_0.2.0                  zlibbioc_1.22.0               XVector_0.16.0                DBI_0.7                      
[29] GGally_1.3.2                  Rcpp_0.12.12                  htmlTable_1.9                 foreign_0.8-69               
[33] bit_1.1-12                    OrganismDbi_1.18.0            Formula_1.2-2                 htmlwidgets_0.9              
[37] httr_1.3.1                    acepack_1.4.1                 R.methodsS3_1.7.1             pkgconfig_2.0.1              
[41] reshape_0.8.7                 nnet_7.3-12                   locfit_1.5-9.1                rlang_0.1.2                  
[45] munsell_0.4.3                 tools_3.4.1                   RSQLite_2.0                   yaml_2.1.14                  
[49] bit64_0.9-7                   caTools_1.17.1                AnnotationFilter_1.0.0        bindrcpp_0.2                 
[53] RBGL_1.52.0                   nlme_3.1-131                  mime_0.5                      R.oo_1.21.0                  
[57] KEGGgraph_1.38.1              compiler_3.4.1                curl_2.8.1                    interactiveDisplayBase_1.14.0
[61] PFAM.db_3.4.1                 tibble_1.3.4                  stringi_1.1.5                 ProtGenerics_1.8.0           
[65] bitops_1.0-6                  httpuv_1.3.5                  rtracklayer_1.36.4            hwriter_1.3.2                
[69] R6_2.2.2                      latticeExtra_0.6-28           KernSmooth_2.23-15            gridExtra_2.2.1              
[73] dichromat_2.0-0               gtools_3.5.0                  assertthat_0.2.0              GenomicAlignments_1.12.2     
[77] Rsamtools_1.28.0              GenomeInfoDbData_0.99.0       mgcv_1.8-17                   rpart_4.1-11                 
[81] biovizBase_1.24.0             shiny_1.0.5                   base64enc_0.1-3 
ADD COMMENTlink modified 5 months ago by Michael Love16k • written 5 months ago by Mehmet Ilyas Cosacak0
gravatar for Michael Love
5 months ago by
Michael Love16k
United States
Michael Love16k wrote:

It’s possible for results to change if you change software versions, although typically the changes are not large in terms of ranking of test statistic. These can be exaggerated when thresholding on adj pvalue.

ADD COMMENTlink written 5 months ago by Michael Love16k

Hi Michael,

thanks for the reply.

Yes, it is possible to have different results. But, the difference is definitely high. 28 genes versus 428 genes!

If we focus on the current one, I still think there is some statistical error.

For Instance, if you use the input_file ( and the script below:

rawCounts = read.delim("", header = TRUE, row.names = "GeneNo")
conditions = gsub("\\_R[1-3]","",colnames(rawCounts))
coldata <- data.frame(row.names = colnames(rawCounts), condition = as.factor(conditions))
dds <- DESeqDataSetFromMatrix(countData = rawCounts, colData = coldata, design = ~ condition)
dds <- DESeq(dds, parallel = T)
res =
normalizedReads =, normalized = TRUE))
resWithNormReads = merge(res,round(normalizedReads,1), by = "row.names")
rownames(resWithNormReads) = resWithNormReads$Row.names
resWithNormReads$Row.names = NULL

subset.baseMean.le.10 = subset(resWithNormReads, abs(log2FoldChange) >= 1.0 & padj < 0.1 & baseMean <= 10)

subset.baseMean.le.10 = subset.baseMean.le.10[order(subset.baseMean.le.10$baseMean, decreasing = FALSE),]

# as you can see it calculates 43 DE genes, though they have low read numbers (baseMean <= 10).

with(subset.baseMean.le.10, plot(baseMean,log2FoldChange, pch = 20, cex = 1))
abline(h =c(-1,1)) = subset(resWithNormReads, baseMean <= 100 & abs(log2FoldChange) >= 1.0 & padj < 0.1 & rowSds(as.matrix(resWithNormReads[,c("Treatment_R1","Treatment_R2","Treatment_R3")])) > 1.5*baseMean) =[[,c("Treatment_R1","Treatment_R2","Treatment_R3")])), decreasing = TRUE),] =[$baseMean, decreasing = TRUE),]

# as you can see, with high standart deviation, the p-value and adj p-value are significant for 47 genes.

t.pvals = c()
for(i in t.pvals = c(t.pvals,[i, 7:9],[i, 10:12])$p.value) =, t.pvals)

# if we use t.test on the normalized reads in for each gene, there is  no significant genes.

I hope I could explain the points that concern me.






ADD REPLYlink written 4 months ago by Mehmet Ilyas Cosacak0

It is known that DESeq2 is more powerful than a row-wise t-test, as it shares information across genes and uses a count-based generalized linear model to model the count data. It's not surprising then that DESeq2 finds genes with high LFC and low mean of normalized counts differentially expressed although they are not called DE by a row-wise t-test of normalized counts. It helps to view the LFC of the genes in context. You can see with the code below that they deviate from the bulk of genes more compatible with the null. The model, using information from all genes, determines that these LFCs are not compatible with LFC=0, with an expected FDR bound of 10%. If you want to hone in on genes with more evidence of strong DE by testing an effect size larger than LFC=0, you can adjust the the lfcThreshold when you call results().

res <- results(dds)
plotMA(res, ylim=c(-8,8))
with(res[which(res$baseMean < 10 & res$padj < .1),], 
  points(baseMean, log2FoldChange, cex=2, col="blue"))
ADD REPLYlink modified 4 months ago • written 4 months ago by Michael Love16k

Hi Micheal,

thanks for your replies. I am not comparing the power of DESeq2 with t.test. What I am trying to say, with high standard deviation, still we get significantly expressed genes.  Moreover, with low read numbers the DESeq2 calculates a log2FoldChange as significant. 

Please check the following genes. I just choose the genes with highest standard deviation in treatments.




ADD REPLYlink written 4 months ago by Mehmet Ilyas Cosacak0

I took a look at your data earlier and I’m not concerned with the genes I highlighted in the plot above. You can follow the suggestions above if you want to raise the LFC or lower the expected FDR.


ADD REPLYlink written 4 months ago by Michael Love16k

Thanks a lot for your suggestions. best, ilyas.

ADD REPLYlink written 4 months ago by Mehmet Ilyas Cosacak0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 166 users visited in the last hour