5

I am not sure I am building the proper design formula for the question I want to answer

I have the following samples with three factors; clone, the structure and the condition.

clone structure diabetic
1 07        2D      Dia
2 21        2D     Ctrl
3 23        2D      Dia
4 32        2D     Ctrl
5 34        2D      Dia
6 43        2D     Ctrl
7 07        3D      Dia
8 21        3D     Ctrl
9 23        3D      Dia
10 32        3D     Ctrl
11 34        3D      Dia
12 43        3D     Ctrl

I want to pull the differentially expressed genes for structure (2D vs 3D) blocking by clone, and the one differentially expressed by condition (regardless of the structure variable).

I am not sure how to build the design in one call, therefore I have produced the first object to pull 2D vs 3D blocking by clone using the following.

des_structure <- DESeqDataSetFromHTSeqCount(sampleTable = samples,
                                       directory = "../data/htseq_geneCounts/",
                                       design= ~ clone+structure)

for the condition controlled by structure I have used

des_condidtion <- ddsHTSeq_diabetic <- DESeqDataSetFromHTSeqCount(sampleTable = samples,
                                                 directory = "../data/htseq_geneCounts/",
                                                 design= ~ structure+diabetic)

I am not sure whether this is the best way to build the designs.

Daniel Standage
  • 5,080
  • 15
  • 50

1 Answers1

6

You can't (easily) use a single design, since clone is nested within diabetic status, so you were correct using two separate designs. Your designs are correct.

If you really wanted to use a single design for some reason, it'd be ~clone+structure and for the latter comparison you'd end up using a rather complicated contrast (something like c(rep(c(1,-1), 3), 0)). I really can't recommend that unless you have a very compelling reason, since it's vastly easier to think in terms of factors for your experiment and you're not hurting anything by fitting twice.

Devon Ryan
  • 19,602
  • 2
  • 29
  • 60