Question: Individuals nested within blocks in DESeq2
0
gravatar for xie186
12 months ago by
xie1860
USA
xie1860 wrote:

Hi there,

I'm trying to identfy the DEGs between treated samples and control samples.

Here is the design:

blk ind cnd ind.n
Blk1 1 Ctrl 1
Blk1 1 Treated 1
Blk1 2 Ctrl 2
Blk1 2 Treated 2
Blk1 3 Ctrl 3
Blk1 3 Treated 3
Blk1 4 Ctrl 4
Blk1 4 Treated 4
Blk2 5 Ctrl 1
Blk2 5 Treated 1
Blk2 6 Ctrl 2
Blk2 6 Treated 2
Blk2 7 Ctrl 3
Blk2 7 Treated 3
Blk2 8 Ctrl 4
Blk2 8 Treated 4

After reading the DESeq2 manual [here] (https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#group-specific-condition-effects-individuals-nested-within-groups), I wrote the code below for simulating this experiment.

I consider this experiment as individuals nested within blocks.

library(DESeq2)
coldata <- DataFrame(blk=factor(rep(c("Blk1","Blk2"),each=8)),
                     ind=factor(rep(1:8,each=2)),
                     #period = factor(rep(c(1, 2, 1, 3, ),each=2)),
                     cnd=factor(rep(c("Ctrl","Treated"),8)))

as.data.frame(coldata)

dds <- makeExampleDESeqDataSet(n=10000, m = nrow(coldata))

coldata$ind.n <- factor(rep(rep(1:4,each=2),2))
as.data.frame(coldata)

colnames(dds) <- paste(as.character(coldata$blk), as.character(coldata$ind), 
                       as.character(coldata$cnd), sep="_")

colData(dds) = coldata
colData(dds)
#dds$blk = coldata$blk
#dds$cnd = coldata$cnd

design(dds) =~ blk + blk:ind.n + blk:cnd
dds <- DESeq(dds)

resultsNames(dds)

### Extract the DEG between treated vs control in block 1
res_blk1_t_vs_c <- results(dds, name=c("blkBlk1.cndTreated"))
plotCounts(dds, gene=which.min(res_blk1_t_vs_c$padj), intgroup=c("cnd", "blk"))
plotCounts(dds, gene=which.max(res_blk1_t_vs_c$padj), intgroup=c("cnd", "blk"))

### Extract the DEG between treated vs control in block 2
res_blk2_t_vs_c <- results(dds, name=c("blkBlk2.cndTreated"))
plotCounts(dds, gene=which.min(res_blk2_t_vs_c$padj), intgroup=c("cnd", "blk"))
plotCounts(dds, gene=which.max(res_blk2_t_vs_c$padj), intgroup=c("cnd", "blk"))

### test if the treatment effect is different across two blocks
res_blk <- results(dds, contrast=list("blkBlk2.cndTreated","blkBlk1.cndTreated"))
plotCounts(dds, gene=which.min(res_blk2_t_vs_c$padj), intgroup=c("cnd", "blk"))
plotCounts(dds, gene=which.max(res_blk2_t_vs_c$padj), intgroup=c("cnd", "blk"))

 

Here are my questions:

If the project goal is to see the effect of treatment on the gene expression using the whole dataset, what comparison would you suggest? Is the code I'm using appropriate?

Based on the DESeq2 manual, if I do the following:

1) extract the DEG between treated vs control in block 1 (c("blkBlk1.cndTreated")); 2)extract the DEG between treated vs control in block 2 (c("blkBlk2.cndTreated")); 3) see whether the treatment effect is different across two blocks. For a particular gene, if it was identified as DEG in 1) and 2) but not 3), then it means it's not block specific. Otherwise, it's block specific.

Is my understanding correct? Is there another way to identify DEG between treated vs treated taking block factor into consideration?

Thanks in advance.

deseq2 nested design • 355 views
ADD COMMENTlink modified 12 months ago by Michael Love24k • written 12 months ago by xie1860

I don't understand the difference between ind and ind.n.  I suspect you don't need ind.n

ADD REPLYlink written 12 months ago by swbarnes2240

Thanks for your replying. 'ind' means indivudla. I have 8 individual animals in the experiment. I adapoted the code here: https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#group-specific-condition-effects-individuals-nested-within-groups

ADD REPLYlink modified 12 months ago • written 12 months ago by xie1860
Answer: Individuals nested within blocks in DESeq2
0
gravatar for Michael Love
12 months ago by
Michael Love24k
United States
Michael Love24k wrote:

"For a particular gene, if it was identified as DEG in 1) and 2) but not 3), then it means it's not block specific. Otherwise, it's block specific."

Basically, yes, this is how I would suggest to analyze this design.

ADD COMMENTlink written 12 months ago by Michael Love24k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 143 users visited in the last hour