Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • id0
    Senior Member
    • Sep 2012
    • 130

    DESeq2 multi-factor designs

    In DESeq2, you can set up a multi-factor design like:
    Code:
    design(dds) <- formula(~ celltype + treatment)
    This would give you the differences attributable to the "treatment" while accounting for the "celltype".

    However, what if you are interested in the differences in response to treatment in different cell types? Instead of looking for the effects of treatment regardless of cell type, you want the effects of treatments that are unique to a specific cell type. How would you get those?
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    Either include an interaction (~celltype*treatment) or just make a "group" factor like:
    Code:
    group <- factor(sprintf("%s_%s", celltype, treatment))
    and then use a model of ~group and use contrasts for the comparisons of interest. You'll get the same results with either method.

    Comment

    • Michael Love
      Senior Member
      • Jul 2013
      • 333

      #3
      Devon's right with a small caveat. Because of log fold change shrinkage (betaPrior=TRUE is default), the results are not exactly the same (they would be the same with betaPrior=FALSE). The interaction model only shrinks the interaction term, while the group model shrinks all the group effects. My advice is: if you are interested in testing for cell type specificity, use the interaction model, because the interaction terms allow you to easily test this. If you are only interested in comparing the treatment effect in each cell type, use the group model, and the contrasts are easy to form this way.

      Comment

      • id0
        Senior Member
        • Sep 2012
        • 130

        #4
        I didn't realize that the interaction and group models would give the same results (at least with betaPrior=FALSE). That is really interesting.

        So if I have two cell types (A and B) and two treatments (Yes and No) and then I combine them for the group model, which contrast is equivalent to the interaction model? I am not sure how I could get the difference in response to treatment using the group model.

        Comment

        • Michael Love
          Senior Member
          • Jul 2013
          • 333

          #5
          The contrast is (ctA_trY + ctB_trN) - (ctA_trN + ctB_trY)

          This is from doing arithmetic on (ctA_trY - ctA_trN) - (ctB_trY - ctB_trN)

          Here's an example in base R. Note the interation term (-2.11)

          Code:
          > y <- rnorm(8)
          > ct <- c(0,0,1,1,0,0,1,1)
          > tr <- c(0,0,0,0,1,1,1,1)
          > lm(y ~ ct*tr)
          
          Call:
          lm(formula = y ~ ct * tr)
          
          Coefficients:
          (Intercept)           ct           tr        ct:tr
              -0.6356       1.1513       0.7684      -2.1120
          Now with group. here, I add + 0 to the design, but you wouldn't do this in DESeq2 with betaPrior=TRUE because we fit a term for each group in addition to an intercept.

          Code:
          > g <- factor(c(1,1,2,2,3,3,4,4))
          > lm(y ~ g + 0)
          
          Call:
          lm(formula = y ~ g + 0)
          
          Coefficients:
               g1       g2       g3       g4
          -0.6356   0.5157   0.1329  -0.8278
          
          > beta <- coef(lm(y ~ g + 0))
          > (beta[1] + beta[4]) - (beta[2] + beta[3])
                 g1
          -2.111991

          Comment

          • id0
            Senior Member
            • Sep 2012
            • 130

            #6
            Thank you for that great explanation.

            The only part I don't understand is this:
            The contrast is (ctA_trY + ctB_trN) - (ctA_trN + ctB_trY)
            How would I provide that to the DESeq2 results function contrasts parameter?

            Comment

            • Michael Love
              Senior Member
              • Jul 2013
              • 333

              #7
              you would use the list style of specifying contrasts, see ?results for more details

              Code:
              results(dds, contrast=list(c("ctA_trY","ctB_trN"),c("ctA_trN","ctB_trY")))

              Comment

              Latest Articles

              Collapse

              • 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...
                Today, 05:17 AM
              • GATTACAT
                Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                by GATTACAT
                Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
                07-01-2026, 11:43 AM
              • SEQadmin2
                Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                by SEQadmin2


                I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

                Here are nine questions we think about, in roughly the order they matter, before...
                06-18-2026, 07:11 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Today, 10:08 AM
              0 responses
              6 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, Yesterday, 11:05 AM
              0 responses
              7 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-02-2026, 11:08 AM
              0 responses
              31 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 06-30-2026, 05:37 AM
              0 responses
              28 views
              0 reactions
              Last Post SEQadmin2  
              Working...