Hi there,
I am having trouble figuring out how to subset my data to look at gene expression within particular groups. I have 38 samples with two factors - temperature with 2 levels (28 and 36), and stage with 3 levels (s1, s2, and s3). While I can readily contrast within each factor
res <- results(dds, contrast=c("stage","s1","s3"), alpha=0.05, lfcThreshold=1) res <- results(dds, contrast=c("temp","28","36"), alpha=0.05, lfcThreshold=1)
I want to be able to look at genes that are differentially expressed between the two temperatures within each stage. I have tried creating a new factor containing only values for a single stage stage3 <- factor(c( "s3", "s3", "s3", "s3", "s3", "s3", "s3","s3" ,"s3","s3" , "s3","s3","s3","s3"))
test <- results(dds, contrast=c("stage3","28","36"), alpha=0.05, lfcThreshold=1)
And get an error message that 28 and 36 should be levels of stage 3, which of course indicates that the way I'm trying to set this up is fundamentally wrong.
Any suggestions would be greatly appreciated!
Session info R version 3.5.3 (2019-03-11) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17134)
Hi, thanks so much for your suggestion. I tried the following (trying to assess DGE between 28 and 36 for stage 3 samples only)
Weird thing is that this actually worked the first time I ran it, and then for some reason when I try to run it again it throws up the following error message for the first line
Error in
[[<-
(*tmp*
, name, value = integer(0)) : 0 elements in value to replace 38 elementsI have changed nothing in my code, checked that all of the factors are properly defined in the dds object, but have had no luck. It's particularly perplexing given that it did run (I have proof in a CSV file I export and subsequent graph I made).
I have also tested with the other two stages (s1 and s2) and get the same error.
Do you have any idea why this might be happening?
You need to walk through the example from the vignette, because you aren't following the example at all.