Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Michel Meyer
    Junior Member
    • Jan 2017
    • 3

    Extract contrast from DESeq2 advanced design

    Dear all,

    I wish to analyze RNAseq experiment data with complex matrix design. The matrix I wish to analyze is the same as displayed in the edgeR documentation section 3.5:
    Code:
       Disease  Patient Treatment
    1  Healthy  1       None
    2  Healthy  1       Hormone
    3  Healthy  2       None
    4  Healthy  2       Hormone
    5  Healthy  3       None
    6  Healthy  3       Hormone
    7  Disease1 4       None
    8  Disease1 4       Hormone
    9  Disease1 5       None
    10 Disease1 5       Hormone
    11 Disease1 6       None
    12 Disease1 6       Hormone
    13 Disease2 7       None
    14 Disease2 7       Hormone
    15 Disease2 8       None
    16 Disease2 8       Hormone
    17 Disease2 9       None
    18 Disease2 9       Hormone
    So, to analyse this kind of matrix design with DESeq2, I have followed the instructions in the DESeq2 vignette section 3.12.1. Creating a "nested" Patient variable (called PN) like that:
    Code:
    > dm
       Disease  PN Treatment
    1  Healthy  P1 None
    2  Healthy  P1 Hormone
    3  Healthy  P2 None
    4  Healthy  P2 Hormone
    5  Healthy  P3 None
    6  Healthy  P3 Hormone
    7  Disease1 P1 None
    8  Disease1 P1 Hormone
    9  Disease1 P2 None
    10 Disease1 P2 Hormone
    11 Disease1 P3 None
    12 Disease1 P3 Hormone
    13 Disease2 P1 None
    14 Disease2 P1 Hormone
    15 Disease2 P2 None
    16 Disease2 P2 Hormone
    17 Disease2 P3 None
    18 Disease2 P3 Hormone
    and using the following design formulae to analyse with DESeq2:
    Code:
    > df
    ~ Disease + Disease:PN + Disease:Treatment
    Using this design matrix and formulae, I got the following output from the resultsNames function:
    Code:
    > dds <- DESeqDataSetFromMatrix(countData=rawData, colData=dm, design=df) 
    > dds <- DESeq(dds, quiet=TRUE)
    > resultsNames(dds)
    [1] "Intercept"             "Disease_Disease2_vs_Disease1"  "Disease_Healthy_vs_Disease1"   "DiseaseDisease1.PNP2"         
    [5] "DiseaseDisease2.PNP2"  "DiseaseHealthy.PNP2"           "DiseaseDisease1.PNP3"          "DiseaseDisease2.PNP3"         
    [9] "DiseaseHealthy.PNP3"   "DiseaseDisease1.TraitmentNone" "DiseaseDisease2.TraitmentNone" "DiseaseHealthy.TraitmentNone"
    So, now I can extract comparisons DiseaseDisease1.TraitmentNone vs DiseaseHealthy.TraitmentNone and DiseaseDisease2.TraitmentNone vs DiseaseHealthy.TraitmentNone, using contrast option of results function.

    However, I'm also interested in comparisons DiseaseDisease1.TraitmentHormone vs DiseaseHealthy.TraitmentHormone and DiseaseDisease2.TraitmentHormone vs DiseaseHealthy.TraitmentHormone. To get these comparisons, I have rerun a DESeq2 analyses after inverting the factor levels from the Treatment condition. So, now I can access to the other ones:
    Code:
    > dm$Traitment
    [1] None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone
    Levels: Hormone None
    > dm$Traitment <- relevel(dm$Traitment,'None')
    > dm$Traitment
    [1] None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone None Hormone
    Levels: None Hormone
    > dds <- DESeqDataSetFromMatrix(countData=rawdata, colData=dm, design=df) 
    > dds <- DESeq(dds, quiet=TRUE)
    > resultsNames(dds)
    [1] "Intercept"             "Disease_Disease2_vs_Disease1"     "Disease_Healthy_vs_Disease1"      "DiseaseDisease1.PNP2"            
    [5] "DiseaseDisease2.PNP2"  "DiseaseHealthy.PNP2"              "DiseaseDisease1.PNP3"             "DiseaseDisease2.PNP3"            
    [9] "DiseaseHealthy.PNP3"   "DiseaseDisease1.TraitmentHormone" "DiseaseDisease2.TraitmentHormone" "DiseaseHealthy.TraitmentHormone"
    I wish to know if it is the right way to get the requested comparisons?
    Because I have seen that the results between (1) DiseaseDisease1.TraitmentNone vs DiseaseHealthy.TraitmentNone and (2) DiseaseDisease2.TraitmentHormone vs DiseaseHealthy.TraitmentHormone are nearly the same:

    Code:
     (1)        (2)
     0,268438  -0,268438
     0,141639  -0,141639
     0,000000   0,000000
    -0,696627   0,696634
     0,000000  -0,973195
     0,034611  -0,034611
     0,530830  -0,530829
    -0,118112   0,118113
    -0,016033   0,016033
     0,270009  -0,270009
     3,021271  -3,021392
     0,000000   0,000000
     0,000000   0,000000
     1,617347  -1,617340
    -0,491919   0,491938
    -0,380177   0,380001
     0,528211  -0,528204
    -0,052266   0,052266
     0,204210  -0,204210
     0,267654  -0,267591
     0,012433  -0,012432
    -0,046289   0,046290
     ...
    Thanks in advance for any help.
    For information, I use R version 3.3.0 (2016-05-03) and DESeq2_1.12.4.
  • shunyip
    Member
    • Oct 2013
    • 20

    #2
    Hello Michel,

    While your way of doing it can be correct, maybe you can use a much simpler way to perform this analysis.

    For example, you can extract DiseaseDisease1.TreatmentNone and DiseaseHealthy.TreatmentNone's samples into one matrix. Then, create a much less complicated design matrix to compare them. (1 condition vs 1 condition) This way, you will definitely know that you are doing the right thing.

    Best,

    Comment

    • Michel Meyer
      Junior Member
      • Jan 2017
      • 3

      #3
      Thank you for your answer.

      Comment

      Latest Articles

      Collapse

      • 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
      • 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

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 07-13-2026, 10:26 AM
      0 responses
      18 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-09-2026, 10:04 AM
      0 responses
      30 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-08-2026, 10:08 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-07-2026, 11:05 AM
      0 responses
      34 views
      0 reactions
      Last Post SEQadmin2  
      Working...