Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
DESeq2 Simon Anders Bioinformatics 123 07-06-2015 01:45 AM
DESeq V DESeq2 sebastion RNA Sequencing 35 10-16-2014 06:04 AM
Getting started with DESeq2 ThePresident Bioinformatics 9 02-27-2014 04:40 PM
DESeq2 SummarizedExperiment help sindrle Bioinformatics 10 10-23-2013 04:20 AM
Differential expression analysis on RPKMs - Contrasts and contrasts of contrasts giorgifm Bioinformatics 6 08-16-2013 10:50 AM

Thread Tools
Old 02-20-2014, 11:49 AM   #1
Location: Massachusetts

Join Date: Jan 2014
Posts: 12
Default DESeq2 Contrasts

I am trying to do contrasts between 3 levels in a factor, and I am running the DESeq command in DESeq using the recommended betaPrior=FALSE argument. However, this command has been running for hours and I think there must be a problem. Its been "fitting model and testing" for three hours and counting...

My data set has 2 factors Treatment (treated vs non) and Type (control, high low).

Here is my code:

> dds <- DESeqDataSetFromMatrix(countData = counts,
+ colData = pData,
+ design = ~ Treatment + Type)

Usage note: the following factors have 3 or more levels:


For DESeq2 versions < 1.3, if you plan on extracting results for
these factors, we recommend using betaPrior=FALSE as an argument
when calling DESeq().
As currently implemented in version 1.2, the log2 fold changes can
vary if the base level is changed, when extracting results for a
factor with 3 or more levels. A solution will be implemented in
version 1.3 which allows for the use of a beta prior and symmetric
log2 fold change estimates regardless of the selection of base level.

> colData(dds)$Type <- factor(colData(dds)$Type,
+ levels=c("control","low", "high"))

> dds <- DESeq(dds, betaPrior = FALSE)
estimating size factors
estimating dispersions
gene-wise dispersion estimates
mean-dispersion relationship
final dispersion estimates
fitting model and testing
cacti is offline   Reply With Quote
Old 02-22-2014, 09:06 AM   #2
Michael Love
Senior Member
Location: Boston

Join Date: Jul 2013
Posts: 333


I haven't seen such a stall before. We re-implemented the use of a beta prior in version 1.3 which will be released with DESeq2 v1.4 in mid-March. This might fix your case and allow use of the moderated fold changes.

If you want to continue using v1.2, because you have a clearly defined base level "control", I would recommend using betaPrior=TRUE. The only caveat we had for this, is that the fold change from low to control and high to control are moderated, so there is an asymmetry to the analysis if you set the base level to `high` for example.

We eliminated this asymmetry in version >= 1.3. However, for experiments as you case, when there is a clearly defined base level (control), I don't see a problem with betaPrior=TRUE. Just ignore the message regarding setting betaPrior to FALSE.
Michael Love is offline   Reply With Quote
Old 02-25-2014, 11:44 AM   #3
Location: Massachusetts

Join Date: Jan 2014
Posts: 12

Thanks Michael.

What do you recommend for analysis across a factor with three levels, none of which is clearly defined as a base level or "control". I am interested in running a comparison across multiple tissue types.
cacti is offline   Reply With Quote
Old 02-25-2014, 11:53 AM   #4
Michael Love
Senior Member
Location: Boston

Join Date: Jul 2013
Posts: 333

If you are using DESeq2 version >= 1.3 (available in the devel branch and released in a few weeks), and you have a variable 'condition' with levels A,B,C, you can do:

dds <- DESeqDataSet(..., design = ~ groupingvar + condition)
dds <- DESeq(dds)
res <- results(dds, contrast=c("condition","B","A")
...for any of the 3 contrasts

If you are using version 1.2, you can set one level as the base level and produce contrasts in the same way as the line above. This includes the ability to contrast the "high" and "low" levels:

res <- results(dds, contrast=c("Type","high","low"))

The only problem in version 1.2 is that the shrinkage in version 1.2 was asymmetric. The LFC's can change slightly if the factors are releveled. We fixed this, but in Bioconductor, changes which would affect user results should only be made every 6 months according to the release schedule.

If are using version 1.2, and if you don't want to set "control" as the base level, or if the potential asymmetry bothers you, you can avoid this asymmetry by setting betaPrior=FALSE.

I wonder if the slow run you experienced is because you are on a machine with limited memory? If not I can try to debug, if you send me a reproducible example of code and a data object. my email is in the package help.
Michael Love is offline   Reply With Quote
Old 08-04-2015, 11:20 AM   #5
Junior Member
Location: Austin, TX

Join Date: Jun 2015
Posts: 7

Hi Dr. Love,

Am I understanding this correctly, that in order to run the comparisons you'll need three separate lines, one for each comparison? The manual indicates that all three contrasts are possible, but I must have missed the example.

Thanks for your help!

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats4 parallel stats graphics grDevices utils
[7] datasets methods base

other attached packages:
[1] calibrate_1.7.2 MASS_7.3-43
[3] genefilter_1.50.0 pheatmap_1.0.7
[5] arrayQualityMetrics_3.24.0 DESeq2_1.8.1
[7] RcppArmadillo_0. Rcpp_0.12.0
[9] GenomicRanges_1.20.5 GenomeInfoDb_1.4.1
[11] IRanges_2.2.5 S4Vectors_0.6.3
[13] RColorBrewer_1.1-2 ggplot2_1.0.1
[15] gplots_2.17.0 DESeq_1.20.0
[17] lattice_0.20-33 locfit_1.5-9.1
[19] Biobase_2.28.0 BiocGenerics_0.14.0
Lohman is offline   Reply With Quote

contrasts, deseq, deseq2, factors, levels

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 07:52 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO