Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JonB
    Member
    • Jan 2010
    • 85

    #1

    DESeq2: struggle to add multiple variables to DESeqDataSet

    Hi,

    I want to add the two variables condition and treatment to my DESeqDataSet, and I thought I had succeeded:

    > ddsHTSeq
    class: DESeqDataSet
    dim: 21680 11
    exptData(0):
    assays(1): counts
    rownames(21680): scign000001 scign000002 ... scign021679 scign021680
    rowData metadata column names(0):
    colnames(11): R1D0B1 R1D2B1 ... R3DxB1 R3DzB1
    colData names(2): condition treatment

    I added four levels to condition and two levels to treatment and I am able to pull out DESeq results from the different levels of condition, but I can't pull out the results from treatment:

    > resTreatment = results(ddsHTSeq, contrast=c("treatment", "cut", "uncut"))

    Any ideas what I am doing wrong?
  • Michael Love
    Senior Member
    • Jul 2013
    • 333

    #2
    hi Jon,

    Can you include the code you used to create ddsHTSeq?

    Comment

    • JonB
      Member
      • Jan 2010
      • 85

      #3
      Here's the code I used:

      Code:
      library("DESeq2")
      
      #Set the directory where the HTSeq count files are located
      directory = "/Users/jonbra/Desktop/Gene_count_files/"
      
      #Catch the files with the pattern "GFF"
      sampleFiles = grep("GFF", list.files(directory), value=TRUE)
      sampleFiles
      
      #Setup sample conditions in the same order of the files in sampleFiles
      sampleCondition = c("D0", "D2", "Dx", "Dz", "D0", "D2", "Dx", "Dz", "D0", "Dx", "Dz")
      sampleName = c("R1D0B1", "R1D2B1", "R1DxB1", "R1DzB1", "R2D0B1", "R2D2B1", "R2DxB1", "R2DzB1", "R3D0B1", "R3DxB1", "R3DzB1")
      sampleTreatment = c("uncut", "cut", "cut", "cut", "uncut", "cut", "cut", "cut", "uncut", "cut", "cut")
      sampleTable = data.frame(sampleName=sampleName, fileName=sampleFiles, condition=sampleCondition, treatment=sampleTreatment)
      sampleTable
      
      #Creates the DESeqDataSet which stores the count data for DESeq2
      ddsHTSeq = DESeqDataSetFromHTSeqCount(sampleTable=sampleTable, directory=directory, design= ~ condition)
      ddsHTSeq
      
      colData(ddsHTSeq)$condition=factor(colData(ddsHTSeq)$condition, levels=c("D0", "D2", "Dx", "Dz"))
      colData(ddsHTSeq)$treatment=factor(colData(ddsHTSeq)$treatment, levels=c("uncut", "cut"))
      I tried to use this design formula instead:

      Code:
      ddsHTSeq = DESeqDataSetFromHTSeqCount(sampleTable=sampleTable, directory=directory, design= ~ treatment + condition)
      But got this error message:

      Error in DESeqDataSet(se, design = design, ignoreRank) :
      the model matrix is not full rank, i.e. one or more variables in the design formula are linear combinations of the others

      Comment

      • Michael Love
        Senior Member
        • Jul 2013
        • 333

        #4
        The problem you will have with modeling ~ treatment + condition is that D0 is indistinguishable from uncut, i.e. all samples which are D0 are also uncut and vice versa. That makes the model impossible to fit as specified.

        If you leave out the treatment variable, you can make comparisons of each level against the other. And you can also make the comparison of D2,Dx,Dz vs D0 (so the treatment contrast you are interested) using the list argument to the contrast argument:

        Code:
        results(dds, 
          contrast=list(c("conditionD2","conditionDx","conditionDz"),"conditionD0"), 
          listValues=c(1/3,-1))

        Comment

        • JonB
          Member
          • Jan 2010
          • 85

          #5
          Ah, I see. That makes sense. Thanks!

          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
          28 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-22-2026, 10:48 AM
          0 responses
          21 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-15-2026, 10:52 AM
          0 responses
          38 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-14-2026, 05:39 AM
          0 responses
          44 views
          0 reactions
          Last Post SEQadmin2  
          Working...