Question: DESeq2: compare all tpts to baseline and pull results table accordingly
0
gravatar for luciest.rodriguez
12 days ago by
luciest.rodriguez0 wrote:

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 design contrast • 64 views
ADD COMMENTlink modified 11 days ago • written 12 days ago by luciest.rodriguez0

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 REPLYlink written 12 days ago by Michael Love25k
Answer: DESeq2: compare all tpts to baseline and pull results table accordingly
0
gravatar for swbarnes2
12 days ago by
swbarnes2330
swbarnes2330 wrote:

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 COMMENTlink written 12 days ago by swbarnes2330

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

ADD REPLYlink written 12 days ago by luciest.rodriguez0
Answer: DESeq2: compare all tpts to baseline and pull results table accordingly
0
gravatar for Michael Love
12 days ago by
Michael Love25k
United States
Michael Love25k wrote:

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 COMMENTlink modified 12 days ago • written 12 days ago by Michael Love25k
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: 179 users visited in the last hour