Deseq2 contrasts and design for paired analysis
1
0
Entering edit mode
Kesava • 0
@8c9ea7d2
Last seen 21 months ago
United States

Hello,

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",
                    "GC93380","ZC5448","YW112","MU27846","MP37616","LN23812",
                    "BJ30461","RR66788","AX70386"),
     patient_id = as.factor(c("patient_10",
                              "patient_10","patient_10","patient_11",
                              "patient_11","patient_11","patient_12","patient_12",
                              "patient_12","patient_14","patient_14","patient_14")),
          group = as.factor(c("test_TP1",
                              "test_TP2","control_TP0","test_TP1","test_TP2",
                              "control_TP0","control_act_TP1","control_act_TP2",
                              "control_TP0","control_act_TP1","control_act_TP2",
                              "control_TP0")))
    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 
resultsNames(deseq_res)

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 <- 
  results(deseq_res, 
          contrast=list(
            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 • 959 views
ADD COMMENT
1
Entering edit mode
@mikelove
Last seen 4 days 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.

ADD COMMENT

Login before adding your answer.

Traffic: 884 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6