DESeq2: compare all tpts to baseline and pull results table accordingly
2
0
Entering edit mode
@luciestrodriguez-22089
Last seen 5.2 years ago

Hi,

I've seen many posts in relation to my question but they all included replicates. My sample file looks like this (had to add bullet points so was readable and not inline):

  • run time sample
  • 1 0 1
  • 2 2 2
  • 3 6 3
  • 4 8 4

I want to compare all of them against baseline so time 0 and then pull the results table after running DESeq2 with all the contrast 0vs2, 0vs6, and 0vs8. I get the error/warning when trying to do the design, listed below.

>samples$time <- relevel(samples$time, ref='0')

I also tried with factor to compare: >samples$condition <- factor(rep(c('0_days','4_days','29_days', '76_days')))

I feel like the problem is here ^ because when I try to get the results for the comparison after running DESeq like below, I want when I do resultsNames(dds1) then I just have 'Intercept' and 'time' but no option for the comparison like 'time0daysvs4_days'

>rownames(samples) <- samples$run >colnames(txi$counts) =samples$run >ddsTxi <- DESeqDataSetFromTximport(txi, colData = samples, design = ~ time)

This is the warning I get it: Error in relevel.default(samples$time, ref = "0") : 'relevel' only for (unordered) factors

When I try and use factors and levels to do compare between timepoint, it doesn't let me input more than one comparison.

>dds1 <- DESeq(ddsTxi)

If I ignore the error and still run DESeq2 then when I pull the results table and try to do contrast then I get this error (also I seem to only be able to do one contrast like 0vs4 at a time)...

Error in if (!expanded & (hasIntercept | noInterceptPullCoef)) { : argument is of length zero

Any help would be appreciated!

deseq2 contrast design • 2.0k views
ADD COMMENT
0
Entering edit mode

Please post the initial error message(s) instead of just saying that you get errors.

Please post all of your code, otherwise it's very difficult to provide help.

ADD REPLY
0
Entering edit mode
swbarnes2 ★ 1.4k
@swbarnes2-14086
Last seen 3 days ago
San Diego

I've seen many posts in relation to my question but they all included replicates

So yours does not? The number of questions that start with "I don't have replicates" and end with good useful answers are few and far between.

You do not need clever algorithms to compare one sample to one sample. And you cannot apply these algorithms to experiments with no replicates. You could do slightly better by comparing all the not time0 samples to the time 0 sample, then you'd have replicates one one side, but with only one time0 sample, it's still not going to work.

ADD COMMENT
0
Entering edit mode

So I can not apply DESeq if I wish to compare only one timepoint 0 to other timepoints?

ADD REPLY
0
Entering edit mode
@mikelove
Last seen 6 days ago
United States

I wonder if you're not using an up-to-date version of DESeq2?

I get the following message when trying to build a DESeqDataSet with an ordered factor (which was added in version 1.21, in May 2018). It's always a good idea to use the latest version of software, as bugs/features/useful messages may have been added to help out your analysis.

Basically, you can't use ordered factors in the design. You can either use a design with (functions of) numeric variables or un-ordered factors only, or as it describes below, you can provide your own custom design matrix.

> dat <- data.frame(x = ordered(c(0,1,2)))
> cts <- matrix(rpois(4*3,10),ncol=3)
> dds <- DESeqDataSetFromMatrix(cts, dat, ~x)
Error in DESeqDataSet(se, design = design, ignoreRank) : 
  the design formula contains an ordered factor. The internal steps
do not work on ordered factors as a formula. Instead you should provide a matrix to
the 'design' slot or to the 'full' argument of DESeq(), constructed using model.matrix.
Calls: DESeqDataSetFromMatrix -> DESeqDataSet
ADD COMMENT

Login before adding your answer.

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