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
                Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                by SEQadmin2



                CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                Despite this, “CRISPR helped turn genome editing from a specialized technique into
                ...
                07-31-2026, 11:01 AM
              • 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

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Yesterday, 10:13 AM
              0 responses
              14 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-31-2026, 02:55 AM
              0 responses
              28 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-24-2026, 12:17 PM
              0 responses
              21 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-23-2026, 11:41 AM
              0 responses
              20 views
              0 reactions
              Last Post SEQadmin2  
              Working...