Unconfigured Ad

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

    #1

    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
        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, Yesterday, 11:13 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, Yesterday, 10:48 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-15-2026, 10:52 AM
      0 responses
      35 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      42 views
      0 reactions
      Last Post SEQadmin2  
      Working...