Question: Time points and donors - errors with contrasts
0
gravatar for sasha
2.3 years ago by
sasha0
sasha0 wrote:

Dear community,

I've been trying to test if there are differentially expressed genes between different time-points of samples taken from the same donors.

Experiment:

SampleID      Donor     TimePoint

A1                   1            T1

A2                   1            T2

A3                   1            T3

A4                   2            T1

A5                   2            T2

A6                   2            T3              

And so it goes until sampleID A12, so in total I have 4 different Donors and for each I have 3 timepoints.

I used a design that takes into account Donor (given that the samples from the same donor are not independent) and TimePoint:  ~ Donor + TimePoint. I then used test="LRT" when calling DESeq function with a reduced design: ~Donor to find genes which are different at any time-point. After that I tried to test individual effects by specifying a contrast in the results function:

Res <- results(DDS, contrast=c("TimePoint","T1","T2"))

But it give me an error:

Error in cleanContrast(object, contrast, expanded = isExpanded, listValues = listValues,  : 
  as T2 is the reference level, was expecting TimePoint_T1_vs_T2 to be present in 'resultsNames(object)'

I also tried:

Res <- results(DDS, contrast=c("TimePoint","T1","T2"), test="Wald")

And it gave me the same error. What am I doing wrong? Should I do this differently?

From just running results without contrast: Res <- results(DDS) I get no errors and the results look as follows:

log2 fold change (MLE): TimePoint2 
LRT p-value: '~ Mother_Child + TimePoint' vs '~ Mother_Child' 
DataFrame with 460 rows and 6 columns
          baseMean log2FoldChange     lfcSE      stat      pvalue      padj
         <numeric>      <numeric> <numeric> <numeric>   <numeric> <numeric>
Otu402    2.279747      0.3111686 0.8422597 0.1381527   0.9332554      0.043
Otu131   22.551497      2.0865825 0.8764297 3.3208392   0.1900592      0.032

Why does it say "TimePoint2"? I thought it was the result of comparing T1 vs T2, because is using as reference TimePoint T1, but when I try relevel to set T2 as reference, the results are exactly the same :(

Please, any help would be greatly appreciated :)

Cheers

Sasha

 

 

 

 

deseq2 contrast • 646 views
ADD COMMENTlink modified 23 months ago by Michael Love25k • written 2.3 years ago by sasha0

Dear Michael,

Thank you for your reply. I checked the character string as you suggested:

> levels(DDS$TimePoint)
[1] "T2" "T1" "T3"

> resultsNames(DDS)
[1] "Intercept"     "Mother_Child1" "Mother_Child2" "Mother_Child3" "TimePoint1"      "TimePoint2"

Just to let you know, Mother_Child = Donor in my case (forgot to state that).

Still don't understand what am I doing wrong. Maybe there's something else I could try changing?

Thanks in advance

Sasha

ADD REPLYlink modified 2.3 years ago by Michael Love25k • written 2.3 years ago by sasha0

Can you show all the code from scratch? It should just give the levels of the variable in resultsNames(), unless you change them after running DESeq()

ADD REPLYlink written 2.3 years ago by Michael Love25k
Answer: Time points and donors - errors with contrasts
0
gravatar for Michael Love
2.3 years ago by
Michael Love25k
United States
Michael Love25k wrote:

You have to be careful that you specify exactly the right character strings you used for the factor levels.

You could check

resultsNames(dds)

or also

levels(dds$TimePoint)

To see what those are

ADD COMMENTlink written 2.3 years ago by Michael Love25k
Answer: Time points and donors - errors with contrasts
0
gravatar for sasha
2.3 years ago by
sasha0
sasha0 wrote:

Hi Michael,

I realised just recently that the problem is related to the "SAN controllers" from the unix system (where I use R studio from) in my institute. They are actually having big problems at the moment. When I repeated everything in my R studio (in my personal computer) everything worked perfectly.

Thanks in advance and sorry for the inconvenience,

Alexandra

ADD COMMENTlink written 2.3 years ago by sasha0
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: 175 users visited in the last hour