How to use a design matrix with two control levels in DESeq2
1
0
Entering edit mode
12 months ago
Pac314 ▴ 10

Hi I am trying to run DESeq2 using a design matrix with two control levels (cont_A and cont_B). I am interested in the following contrasts:

  1. grp_A1 vs cont_A
  2. grp_A2 vs cont_A
  3. grp_B1 vs cont_B
  4. grp_B2 vs cont_B
  5. grp_B3 vs cont_B

My output for dput on colData:

structure(list(group = structure(c(1L, 1L, 1L, 1L, 3L, 3L, 3L, 
3L, 5L, 5L, 5L, 5L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 
5L, 6L, 6L, 6L, 6L), levels = c("cont_A", "cont_B", "grp_A1", 
"grp_B1", "grp_B2", "grp_B3"), class = "factor"), replicate = structure(c(1L, 
2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 
2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L), levels = c("rep1", 
"rep2", "rep3", "rep4"), class = "factor")), class = "data.frame", row.names = c("S1", 
"S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "S10", "S11", 
"S12", "S13", "S14", "S15", "S16", "S17", "S18", "S19", "S20", 
"S21", "S22", "S23", "S24", "S25", "S26", "S27", "S28"))
dds <- DESeqDataSetFromTximport(txi, colData=colData, 
                                design=~replicate+group)
dds

# extracting results with contrast
res <- results(dds, contrast=c('group', 'grp_B1', 'cont_B')
# shrinking lfc
res <- lfcshrink(dds, coef='group_grp_B1_vs_cont_B', res=res, type='apeglm')

When I shrink the LFC with apeglm I get the following error:

Error in lfcShrink(dds, coef = "group_grp_B1_vs_cont_B", type = "apeglm") : 
  coef %in% resultsNamesDDS is not TRUE

The resultsNames() output:

> resultsNames(dds)
 [1] "Intercept"              "replicate_rep2_vs_rep1" "replicate_rep3_vs_rep1" "replicate_rep4_vs_rep1"
 [5] "group_grp_B1_vs_cont_A"    "group_grp_B2_vs_cont_A"    "group_grp_B3_vs_cont_A"    "group_cont_B_vs_cont_A"   
 [9] "group_grp_A1_vs_cont_A"     "group_grp_A2_vs_cont_A"
design_matrix contrast DESeq2 • 287 views
ADD COMMENT

Login before adding your answer.

Traffic: 2576 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