DESEq2 Paired samples: Baseline Versus each Timepoint
1
0
Entering edit mode
Dave • 0
@dave-12583
Last seen 6.4 years ago

Hello

 

I am a newbie and I have the following experimental factors as below. I read very carefully the different posts and tutorial but I am still uncertain on how to design my experiment formula.

I wanted to know how to use DSEQ2 to look at the paired samples to see which genes are being differentially expressed when compared to Baseline eg:

Q1) Baseline Vs Day1: list of DE genes

Q2) Baseline Vs Day2: list of DE genes

Q3) Baseline Vs Day3: list of DE genes

 

eg: design(dds)=~ Patient.ID + Timepoint

Is that right ??? How do you get the DE list of genes for each Q1-Q3 above ??
Can Someone please help ?

Thank you in advance

>df
 Patient.ID library Timepoint
1           1       A  Baseline
2           1       A      Day1
3           1       A      Day2
4           1       A      Day3
5           2       A  Baseline
6           2       A      Day1
7           2       A      Day2
8           2       A      Day3
9           4       A  Baseline
10          4       A      Day1
11          4       A      Day2
12          4       A      Day3
13          5       B  Baseline
14          5       B      Day1
15          5       B      Day2
16          5       B      Day3
17         10       B  Baseline
18         10       B      Day1
19         10       B      Day2
20         10       B      Day3
21         11       B  Baseline
22         11       B      Day1
23         11       B      Day2
24         11       B      Day3
25         13       C  Baseline
26         13       C      Day1
27         13       C      Day2
28         13       C      Day3
29         17       C  Baseline
30         17       C      Day1
31         17       C      Day2
32         17       C      Day3
33         18       C  Baseline
34         18       C      Day1
35         18       C      Day2
36         18       C      Day3
 
deseq2 • 2.7k views
ADD COMMENT
0
Entering edit mode

Thanks Michael for your answers and time.

A follow up question:

 

How do I compare:

Q1) Baseline Vs Day1 for a given library : list of DE genes

a) For Library A only :Baseline Vs Day1: list of DE genes

a) For Library B only :Baseline Vs Day1: list of DE genes

a) For Library C only :Baseline Vs Day1: list of DE genes

Would it be something like:

 

a) contrast=c("Timepoint", "Library", "Day1", "Baseline", "A")

b) contrast=c("Timepoint", "Library", "Day1", "Baseline", "B")

a) contrast=c("Timepoint", "Library", "Day1", "Baseline", "C")

 

Thank you very much again in advance

ADD REPLY
0
Entering edit mode

Your first post didn't mention wanting library-specific changes over time controlling for individual, so the design I recommended doesn't work for this.

Instead you should use the setup and design that I discuss in this section of the vignette:

https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#group-specific-condition-effects-individuals-nested-within-groups

ADD REPLY
0
Entering edit mode

Thanks Michael

I tried the last few hours to get this working with the link you sent. I keep getting:

"Error in checkFullRank(modelMatrix) :
  the model matrix is not full rank, so the model cannot be fit as specified."

I changed the colnamesin my above design to

from (Patient.ID library Timepoint) to (ind grp cnd)

when I run:

DESeqDataSetFromMatrix(countData = a,  colData = b, design=formula(~ grp + grp:ind + grp:cnd))
Error in checkFullRank(modelMatrix) :
  the model matrix is not full rank, so the model cannot be fit as specified.
  Levels or combinations of levels without any samples have resulted in
  column(s) of zeros in the model matrix.

Any ideas

Thanks in advance

ADD REPLY
0
Entering edit mode

Can you show your code? I can’t tell what you are doing, if you are following all the steps. You will need to remove two columns of the matrix as described in that section because you have 4 patients for the first group but 3 patients for the other groups. There is some mention of this if you read to the end of the section.

ADD REPLY
0
Entering edit mode

Thanks Michael

Its no longer giving me the error, the missing columns was causing the problem and it is written down in your docs, my apologizies.

I modified the input file inline with equal columns across the groups as below. When convenient would you or someone please check my code below?

My questions are:

I wanted to do a paired analysis to find DE genes:

a) between Day0 and Day1 in Group1

b) between Day0 and Day1 in Group2

c) between Day0 and Day1 in Group3
d) between Day0 and Day1 in Group4

and the same for Day0 and Day7 in each Group1-4

 

Thank you very much and apologizies for the inconvenience

 

 

 

dds<- DESeqDataSetFromMatrix(countData =a,b,~ grp + grp:ind.n + grp:cnd

dds<-DESeq(dds)
For Question a) above it would be (?):
res<-results(dds, contrast=c("cnd","grp","Day1","Day0", "1"))

 

 

ind    cnd    ind.n    grp
abcds101    Day0    1    1
abcds101    Day1    1    1
abcds101    Day7    1    1
abcds102    Day0    2    1
abcds102    Day1    2    1
abcds102    Day7    2    1
abcds103    Day0    3    1
abcds103    Day1    3    1
abcds103    Day7    3    1
abcds104    Day0    4    1
abcds104    Day1    4    1
abcds104    Day7    4    1

abcds116    Day0    1    2
abcds116    Day1    1    2
abcds116    Day7    1    2
abcds117    Day0    2    2
abcds117    Day1    2    2
abcds117    Day7    2    2
abcds118    Day0    3    2
abcds118    Day1    3    2
abcds118    Day7    3    2
abcds119    Day0    4    2
abcds119    Day1    4    2
abcds119    Day7    4    2

abcds211    Day0    1    3
abcds211    Day1    1    3
abcds211    Day7    1    3
abcds212    Day0    2    3
abcds212    Day1    2    3
abcds212    Day7    2    3
abcds213    Day0    3    3
abcds213    Day1    3    3
abcds213    Day7    3    3
abcds214    Day0    4    3
abcds214    Day1    4    3
abcds214    Day7    4    3

abcds306    Day0    1    4
abcds306    Day1    1    4
abcds306    Day7    1    4
abcds307    Day0    2    4
abcds307    Day1    2    4
abcds307    Day7    2    4
abcds308    Day0    3    4
abcds308    Day1    3    4
abcds308    Day7    3    4
abcds309    Day0    4    4
abcds309    Day1    4    4
abcds309    Day7    4    4

 

 

ADD REPLY
0
Entering edit mode

You should have terms for all of these comparisons in resultsNames(dds) and you can just use results(dds, name="...") to pull them out. 

ADD REPLY
0
Entering edit mode

Thanks Michael. Works very nicely.

One thing I am not sure about, how does DESEQ2 know which timepoints the user wants to do the paired analysis between ?

For example not just "Day0 Versus Day1" but also "Day1 versus Day7"

Thanks as always for your help and time.

 

ADD REPLY
0
Entering edit mode

All coefficients are comparisons are against baseline (day 0). To compare day 7 with day 1 you can use ‘contrast’ with a list and the two coefficients as the elements in the list. See ?results

ADD REPLY
0
Entering edit mode
@mikelove
Last seen 10 hours ago
United States

Yes, that's the right design, accounting for a patient effect for baseline.

Then you just use

results(dds, contrast=c("Day1","Baseline"))

etc.

ADD COMMENT
0
Entering edit mode

Minor typo that might confuse a newbie: contrast=c("Timepoint", "Day1", "Baseline") ?  

 

ADD REPLY
0
Entering edit mode
Yes, thank you!
ADD REPLY

Login before adding your answer.

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