Hi,
I have a question to the DESeq2 contrast. I have single end reads from 16 samples with 4 treatments (group) and 4 biological replicates (indi). However, the replicates are not evenly distributed across the used flowcells (flow). Can I still correct for the flowcell batch effect?
My meta table looks like this:
group indi flow
T1 I1 A
T1 I2 A
T1 I3 B
T1 I4 B
T2 I1 A
T2 I2 A
T2 I3 B
T2 I4 B
T3 I1 A
T3 I2 A
T3 I3 B
T3 I4 B
T4 I1 A
T4 I2 A
T4 I3 B
T4 I4 B
I followed the instructions for such case from the DESeq2 manual:
ds_txi <- DESeqDataSetFromTximport(txi = txi_salmon,
colData = meta,
design = ~ indi+group)
ds_txi$indi_n <- c("I1","I2","I1","I2","I1","I2","I1","I2","I1","I2","I1","I2","I1","I2","I1","I2")
meta$indi_n <- c("I1","I2","I1","I2","I1","I2","I1","I2","I1","I2","I1","I2","I1","I2","I1","I2")
meta$indi_n <- as.factor(meta$indi_n)
ds_txi$indi_n <- as.factor(ds_txi$indi_n)
ds_txi <- DESeqDataSetFromTximport(txi = txi_salmon,
colData = meta,
design = ~ flow + flow:indi_n + flow:group)
Resulting in following meta table:
group indi flow indi_n
T1 I1 A I1
T1 I2 A I2
T1 I3 B I1
T1 I4 B I2
T2 I1 A I1
T2 I2 A I2
T2 I3 B I1
T2 I4 B I2
T3 I1 A I1
T3 I2 A I2
T3 I3 B I1
T3 I4 B I2
T4 I1 A I1
T4 I2 A I2
T4 I3 B I1
T4 I4 B I2
With following contrast, I get the difference between treatment T1 and T2 within Batch A:
dds<- DESeq(ds_txi)
res<- results(dds,contrast=list("flowA.groupT1","flowA.groupT2"), alpha= p_adjust_treshold, lfcThreshold = L2FC_treshold)
But how can I get the general differences between treatment (group) T1 and T2 with elimination of the batch effect, if thats possible?
Could I maybe just do something like this:
res<- results(dds,contrast=list(c("flowA.groupT1","flowB.groupT1"),c("flowA.groupT2","flowB.groupT2")), alpha= p_adjust_treshold, lfcThreshold = L2FC_treshold)
PCA plots: