Deseq2 contrasts and design for paired analysis
Entering edit mode
Kesava • 0
Last seen 23 days ago
United States


In addition to the Deseq2 manual, these are the posts that I read before coming up with the code.

grouping design

I have converted my data into a group and I have time-series data as follows.

# Reprex for the phenotype data

    colData <- data.frame(
      row.names = c("DY32156","JZ72116","ZX19451",
     patient_id = as.factor(c("patient_10",
          group = as.factor(c("test_TP1",
    patient_id  group
DY32156 patient_10  test_TP1
JZ72116 patient_10  test_TP2
ZX19451 patient_10  control_TP0
GC93380 patient_11  test_TP1
ZC5448  patient_11  test_TP2
YW112   patient_11  control_TP0
MU27846 patient_12  control_act_TP1
MP37616 patient_12  control_act_TP2
LN23812 patient_12  control_TP0
BJ30461 patient_14  control_act_TP1
RR66788 patient_14  control_act_TP2
AX70386 patient_14  control_TP0

I used the following design for a paired analysis

# Deseq2 design
ddsMat <- DESeqDataSetFromMatrix(countData = countData,
                                 colData = colData, 
                                 design = ~ patient_id + group)

# Set the reference
ddsMat$group <- relevel(ddsMat$group, ref = "control_TP0")

# Perfrom deseq2
deseq_res <- DESeq(ddsMat, parallel = T)

# Check the 

1 "Intercept"
2 "patient_id_patient_11_vs_patient_10" [3] "patient_id_patient_12_vs_patient_10" [4] "patient_id_patient_13_vs_patient_10" [5] "patient_id_patient_14_vs_patient_10" [6] "patient_id_patient_15_vs_patient_10" [7] "patient_id_patient_16_vs_patient_10" [8] "patient_id_patient_18_vs_patient_10" [9] "patient_id_patient_20_vs_patient_10" [10] "patient_id_patient_3_vs_patient_10"
[11] "patient_id_patient_4_vs_patient_10"
[12] "patient_id_patient_6_vs_patient_10"
[13] "patient_id_patient_8_vs_patient_10"
[14] "group_control_act_TP1_vs_control_TP0" [15] "group_control_act_TP2_vs_control_TP0" [16] "group_test_TP1_vs_control_TP0"
[17] "group_test_TP2_vs_control_TP0"

# Genes that have changed over time in the test group in reference to active control group
test_vs_act_control_all_tp <- 
            c("group_test_TP2_vs_control_TP0", "group_test_TP1_vs_control_TP0" ),
            c("group_control_act_TP2_vs_control_TP0", "group_control_act_TP1_vs_control_TP0")), test="Wald")

Please let me know if I am using the design and contrasts correctly to perform a paired analysis and to see genes that have shown a difference in the test group when compared to the active control over time.

Thank you very much for your time on this query.

TimeSeriesExperiment RNASeq design DESeq2 • 159 views
Entering edit mode
Last seen 1 day ago
United States

Due to time constraints, I only have time to answer software-related questions on the support site. For questions about statistical design and analysis, I recommend collaborating with a local statistician or someone familiar with analyzing linear models in R.


Login before adding your answer.

Traffic: 490 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6