No announcement yet.
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2

    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.


    • #3
      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.


      • #4
        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.


        • #5
          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
          [4] LC_NUMERIC=C
          [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


          Latest Articles


          • seqadmin
            Advanced Methods for the Detection of Infectious Disease
            by seqadmin

            The recent pandemic caused worldwide health, economic, and social disruptions with its reverberations still felt today. A key takeaway from this event is the need for accurate and accessible tools for detecting and tracking infectious diseases. Timely identification is essential for early intervention, managing outbreaks, and preventing their spread. This article reviews several valuable tools employed in the detection and surveillance of infectious diseases.
            11-27-2023, 01:15 PM
          • seqadmin
            Strategies for Investigating the Microbiome
            by seqadmin

            Microbiome research has led to the discovery of important connections to human and environmental health. Sequencing has become a core investigational tool in microbiome research, a subject that we covered during a recent webinar. Our expert speakers shared a number of advancements including improved experimental workflows, research involving transmission dynamics, and invaluable analysis resources. This article recaps their informative presentations, offering insights...
            11-09-2023, 07:02 AM





          Topics Statistics Last Post
          Started by seqadmin, 12-01-2023, 09:55 AM
          0 responses
          Last Post seqadmin  
          Started by seqadmin, 11-30-2023, 10:48 AM
          0 responses
          Last Post seqadmin  
          Started by seqadmin, 11-29-2023, 08:26 AM
          0 responses
          Last Post seqadmin  
          Started by seqadmin, 11-29-2023, 08:12 AM
          0 responses
          Last Post seqadmin