Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • ysnapus
    Member
    • Jun 2013
    • 22

    Understanding DESeq2 dispersion estimates

    I construct a toy dataset with
    Code:
    > m
          Control  Case
    GeneA    3891  4591
    GeneB   69543 72122
    > colData
                 cc
    Case       Case
    Control Control
    > d <- DESeqDataSetFromMatrix(m, colData=colData, design =~cc)
    Then, I get the gene-wise dispersion
    Code:
    > d <- estimateSizeFactors(d)
    > d <- estimateDispersionsGeneEst(d)
    > mcols(d)
    DataFrame with 2 rows and 5 columns
       baseMean     baseVar   allZero dispGeneEst dispGeneEstConv
      <numeric>   <numeric> <logical>   <numeric>       <logical>
    1  4228.732    37181.63     FALSE 0.001842478            TRUE
    2 70857.604 10439534.06     FALSE 0.002065126            TRUE
    Now, I want to check i the dispersion estimates are just fitting a negative binomial on each gene's count (pooled conditions).
    Code:
    > fitdistr(as.vector(round(counts(d, normalize=T)[1,])),"negative binomial")
         size         mu    
      1207.3898   4228.5000 
     (1543.6506) (  97.5636)
    > fitdistr(as.vector(round(counts(d, normalize=T)[2,])),"negative binomial")
          size          mu    
        970.5831   70857.5000 
     (  982.6550) ( 1616.2617)

    Now the dispersion is the inverse of size, so it should be
    Code:
    > c(1/1207.3898, 1/970.5831)
    [1] 0.0008282329 0.0010303085
    But this is different from
    Code:
    > mcols(d)$dispGeneEst
    [1] 0.001842478 0.002065126
  • Simon Anders
    Senior Member
    • Feb 2010
    • 995

    #2
    No, it does not work like that. First of all, DESeq2's model is that the counts are NB-distributed. You have fit an NB distribution to the rounded normalized counts instead. Why would you do that? Also, you don't have any residual degrees of freedom in your setting, so your example is ill-defined anyway.

    Maybe have a look at our preprint, with all the mathematical details in the Methods section: http://doi.org/10.1101/002832

    Comment

    • Dario1984
      Senior Member
      • Jun 2011
      • 166

      #3
      Last month, Gordon Smyth wrote on the Bioconductor list that edgeR with rounded counts would be an acceptable input for the analysis. EBseq, however, handles this kind of data without rounding.

      Comment

      • Simon Anders
        Senior Member
        • Feb 2010
        • 995

        #4
        Of course, all these tools will accept any kind of integer data, no matter whether it is real counts or some other data that has been rounded to make it look like counts. Whether the latter makes any sense depends a lot on circumstances. (By definition of the English word, a "count" is an integer. If you need to round it first, it was not a count in the first place. Hence, "rounded counts" is a contradiction in terms -- what Gordon meant is simply that if you have non-integer data which are for some reason more or less close to the counts that you should have if you had counted correctly, the rounding is fine.)

        But what does all this have to do with the OP's question, and with my answer, neither of which was about using rounded something as input?

        Comment

        • Dario1984
          Senior Member
          • Jun 2011
          • 166

          #5
          Thank you for clarifying that. I hadn't read the code.

          Comment

          Latest Articles

          Collapse

          • SEQadmin2
            Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
            by SEQadmin2


            Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

            The systematic characterization of the human proteome has
            ...
            07-20-2026, 11:48 AM
          • SEQadmin2
            Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
            by SEQadmin2



            Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
            ...
            07-09-2026, 11:10 AM
          • SEQadmin2
            Cancer Drug Resistance: The Lingering Barrier to Rising Survival
            by SEQadmin2



            Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

            There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
            07-08-2026, 05:17 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, 07-24-2026, 12:17 PM
          0 responses
          31 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-23-2026, 11:41 AM
          0 responses
          23 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-20-2026, 11:10 AM
          0 responses
          215 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-13-2026, 10:26 AM
          0 responses
          79 views
          0 reactions
          Last Post SEQadmin2  
          Working...