Unconfigured Ad

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

    #1

    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
                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                by SEQadmin2



                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                ...
                10-14-2026, 09:55 AM
              • SEQadmin2
                New Genomics Technologies Take Aim at Long-Standing Limits
                by SEQadmin2


                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                ...
                09-28-2026, 10:25 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 10-22-2026, 11:13 AM
              0 responses
              27 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 10:48 AM
              0 responses
              20 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-15-2026, 10:52 AM
              0 responses
              36 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-14-2026, 05:39 AM
              0 responses
              43 views
              0 reactions
              Last Post SEQadmin2  
              Working...