DESeq2, batch effect correction, multiple conditions
1
0
Entering edit mode
13 months ago
Sy80 ▴ 10

Hi all,

I have 2 batches of RNA-seq experiments with two conditions: genotype (wt, mut) and age (P2, P10 and P30). I would like to use DESeq2 to compare genotypes at each of the different ages. How can I make this comparison while accounting for the batch effect?

 dds <- DESeqDataSetFromMatrix(countData = all, colData=annot,  design= ~ Batch + Age + Genotype)
dds <- DESeq(dds, test="Wald")
resultsNames(dds)


If I run resultsNames(dds), I have the following tests:

resultsNames(dds)
[1] "Intercept"
[2] "group_Batch1P2wt_vs_Batch1P2mut"
[3] "group_Batch1P10mut_vs_Batch1P2mut"
[4] "group_Batch1P10wt_vs_Batch1P2mut"
[5] "group_Batch2P30mut_vs_Batch1P2mut"
[6] "group_Batch2P30wt_vs_Batch1P2mut"
[7] "group_Batch2P2mut_vs_Batch1P2mut"
[8] "group_Batch2P2wt_vs_Batch1P2mut"
[9] "group_Batch2P10mut_vs_Batch1P2mut"
[10] "group_Batch2P10wt_vs_Batch1P2mut"


I would like to compare e.g. P10wt to P10mut regardless of the batch; how can I do this?

I know the following code is incorrect, but in essence something like this:

res_test <- results(dds, contrast=c("group", c("Batch2P2mut", "Batch1P2mut"), c("Batch2P2wt", "Batch1P2wt")))


Thank you!

RNA-Seq DEseq2 • 910 views
0
Entering edit mode
11 months ago

Hey!

What is contained in age? To control for batch (and age?), you simply have to include them in the design formula, as you have already done.

Also, are you showing us all of your code (?), because it can be inferred from your resultsNames that you also have a group variable in your design formula, but the actual design formula that you present does not show this.

For all intents and purposes, you simply need to do:

dds <- DESeqDataSetFromMatrix(countData = all,
colData=annot,  design= ~ Genotype + Age + Batch)
dds <- DESeq(dds)
res_test <- results(dds, contrast = c('Genotype', 'P2mut', 'P2wt'))
res_test <- lfcShrink(dds, contrast = c('Genotype', 'P2mut', 'P2wt'),
res = res_test, type = 'normal')


This will account for the effect of age and batch while calculating test statistics for P2mut / P2wt.

Also, be aware of the fold change shrinkage methods that you ought to be using. Here, i am using the original 'normal' method, which may not be suitable for all situations.

Kevin