DESeq2 Error in checkContrast(contrast, resNames) : when using list()
1
0
Entering edit mode
gtechbio ▴ 10
@gtechbio-13996
Last seen 23 days ago
Spain

Hi, I have the following RNA-Seq design (a subset):

Time    Albumin Media   Group
0h  noAlbumin   Host    0h.noAlbumin
0h  withAlbumin Host    0h.withAlbumin
0h  noAlbumin   Plastic 0h.noAlbumin
0h  withAlbumin Plastic 0h.withAlbumin
24h noAlbumin   Host    24h.noAlbumin
24h withAlbumin Host    24h.withAlbumin
24h noAlbumin   Plastic 24h.noAlbumin
24h withAlbumin Plastic 24h.withAlbumin
3h  noAlbumin   Host    3h.noAlbumin
3h  withAlbumin Host    3h.withAlbumin
3h  noAlbumin   Plastic 3h.noAlbumin
3h  withAlbumin Plastic 3h.withAlbumin

I run DESeq2 as below:

pre_dds <- DESeqDataSetFromMatrix(yeast, colData_DE, design = ~Media+Group+Media:Group)

dds <- DESeq(pre_dds)

At 24h, I want to get the effect of albumin on Plastic (the reference level), interaction term, and effect of albumin on Host.

The first two work:

results(dds, contrast = c("Group","24h.withAlbumin", "24h.noAlbumin"))
results(dds, name="MediaHost.Group24h_withAlbumin")

But the last one throws an error:

results(dds, list( c("Group_24h.withAlbumin_vs_24h.noAlbumin","MediaHost.Group24h.withAlbumin") ))
Error in checkContrast(contrast, resNames) : 
  all elements of the contrast as a list of length 2 should be elements of 'resultsNames(object)'

I am wondering why is this happening and how can I specify that contrast in the results()?

DESeq2 • 227 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 7 hours ago
United States

Try a little debugging here:

cntrst <- c("Group_24h.withAlbumin_vs_24h.noAlbumin","MediaHost.Group24h.withAlbumin")
cntrst %in% resultsNames(dds)

Might be just a typo.

ADD COMMENT
0
Entering edit mode

hi Michael, many thanks for the swift reply!

My resultsNames(dds) look like:

 [1] "Intercept"                             "Media_Host_vs_Plastic"                
 [3] "Group_0h.withAlbumin_vs_0h.noAlbumin"  "Group_24h.noAlbumin_vs_0h.noAlbumin"  
 [5] "Group_24h.withAlbumin_vs_0h.noAlbumin" "Group_3h.noAlbumin_vs_0h.noAlbumin"   
 [7] "Group_3h.withAlbumin_vs_0h.noAlbumin"  "MediaHost.Group0h.withAlbumin"        
 [9] "MediaHost.Group24h.noAlbumin"          "MediaHost.Group24h.withAlbumin"       
[11] "MediaHost.Group3h.noAlbumin"           "MediaHost.Group3h.withAlbumin"

The comparison I want is not there readily, but the contrast results(dds, contrast = c("Group","24h.withAlbumin", "24h.noAlbumin")) works. I tried different things, for example changing the "." to "_", changing the names of variable, etc, but so far nothing worked. Is there a different way to retrieve that contrast? I am on DESeq2_1.26.0

Thanks once again

ADD REPLY
0
Entering edit mode

Oh I see. Yes, you can't refer to a coefficient that doesn't exist.

You need to build up to the difference. So you have Group_24h.withAlbumin_vs_0h.noAlbumin as the albumin effect in reference, and then you need to add the interaction MediaHost.Group24h.withAlbumin.

ADD REPLY
0
Entering edit mode

sorry for a naive question (probably I am not following), isn't the Group_24h.withAlbumin_vs_0h.noAlbumin comparing 24h with albumin vs 0h without albumin? I need to get the effect of albumin at 24h.

ADD REPLY
0
Entering edit mode

I'm sorry, I don't have a lot of time to walk through interpretation of results -- for that I always recommend to consult a statistician or someone familiar with linear models in R. I make myself available here for software related issues.

ADD REPLY
0
Entering edit mode

Understood, thank anyway! Just the last clarification which will help me dig further: Do you mean that:

results(dds, list( c("Group_24h.withAlbumin_vs_0h.noAlbumin","MediaHost.Group24h.withAlbumin") ))

gets the effect of albumin at 24h on the Host?

cheers

ADD REPLY
0
Entering edit mode

That's 24 h albumin vs 0h no albumin in host. This is probably a case where you're better off not grouping time and albumin status. It would be easier to set up the design and contrasts with albumin treatment, time, and media as three variables.

ADD REPLY

Login before adding your answer.

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