Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alex234
    Member
    • Aug 2013
    • 31

    #1

    Contradictory log-fold-change figures from DESeq?

    Hello, I have made a couple of figures in DESeq, the first should plot genes with adjusted p-value <0.05 in red with >0.05 genes in grey, and was made with:

    plotMA(res,
    + col = ifelse(res$padj>0.05, "gray69", "red3"),
    + linecol = "#ff000080",
    + xlab = "mean of normalized counts", ylab = expression(log[2]~fold~change),
    + log = "x", cex=0.45)
    > dev.off()


    The second should just plot genes that have a p-value >0.05 (i.e. all the red ones from the first figure):

    resSig = res[res$padj <0.05, ]
    > plotMA(resSig)


    And yet there are red points in the first (padj<0.05) that are not present in the second! Can anybody explain this to me? I have attached the two figures.

    And on a related note, is it better to use the p-value or adjusted p-value that DESeq gives you?

    Many thanks

    Alex
    Attached Files
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    Always use the adjusted p-value.

    The differences look to be simply due to the different scales on the graphs and perhaps the fact that you're using a slightly different coloring/inclusion threshold in each.

    If you instead did something like:
    Code:
    plotDE <- function(res)
        plot(res$baseMean, res$log2FoldChange, col = ifelse(res$padj>=0.05, "gray69", "red3"), log="x", pch=6, xlim=c(0.1,1e5), ylim=c(-4,4)))
    plotDE(res)
    resSig <- res[which(res$padj<0.05),]
    plotDE(resSig)
    then the two graphs should be more or less identical. The plotMA function is just a nicer version of the "plotDE" function I pasted above (in fact, if you just type "plotMA", without quotes, you'll see exactly what the function does).

    Comment

    • Alex234
      Member
      • Aug 2013
      • 31

      #3
      Thanks, I'm still not sure what was wrong with plotMA, but the plotDE line you gave me works fine!


      Thanks

      Alex

      Comment

      • Alex234
        Member
        • Aug 2013
        • 31

        #4
        Hi, got a related problem now where the scatterplot of ordinary vs moderated log ratios in DESeq seems to be wrong - the points seem to be upside down (picture attached and lines of code below)

        Would be grateful for any advice! (and do you know how I can retrieve the variance stabilised data into an excel/txt/csv file?)

        Thanks

        Alex

        > mod_lfc = (rowMeans( exprs(vsd)[, conditions(cds)=="WT", drop=FALSE] ) -
        + rowMeans( exprs(vsd)[, conditions(cds)=="KO", drop=FALSE] ))

        > lfc = res$log2FoldChange
        > table(lfc[!is.finite(lfc)], useNA="always")

        > logdecade = 1 + round( log10( 1+rowMeans(counts(cdsBlind, normalized=TRUE)) ) )
        > lfccol = colorRampPalette( c( "gray", "blue" ) )(6)[logdecade]

        > ymax = 4.5
        > pdf("Ordinary vs Moderated Log ratios.pdf")
        > plot( pmax(-ymax, pmin(ymax, lfc)), mod_lfc,
        + xlab = "ordinary log-ratio", ylab = "moderated log-ratio",
        + cex=0.45, asp=1, col = lfccol,
        + pch = ifelse(lfc<(-ymax), 60, ifelse(lfc>ymax, 62, 16)))
        > abline( a=0, b=1, col="red3")
        Attached Files

        Comment

        • dpryan
          Devon Ryan
          • Jul 2011
          • 3478

          #5
          Regarding the plot, I would check that res$log2FoldChange is log2(WT/KO) rather than log2(KO/WT), as it appears that there's just a swapped axis somewhere. Regarding writing the vsd data, the exprs() function returns a matrix, so you can just write.csv or write.delim to write to a file.

          Comment

          • Alex234
            Member
            • Aug 2013
            • 31

            #6
            Great, both worked - re: the vsd data (the numbers are counts?): can/should this be used in the same way as the original counts data to look at DEGs (since the problem of 0 counts seems to have been dealt with), or is it just a form that the data needs to be in to produce PCAs and sample-to-sample difference heatmaps?


            Thanks, I really appreciate your help!

            Alex

            Comment

            • dpryan
              Devon Ryan
              • Jul 2011
              • 3478

              #7
              Well, variance stabilized numbers are transformed counts. If you're interested in doing the DEG analysis in DESeq (or edgeR or other similar packages), then you'll find these sorts of transformations most useful for QC, such as PCA and heatmaps. That doesn't mean that you can't use variance stabilized data for DEG analysis. Voom, which is used to transform RNAseq data for use in analysis by limma, is effectively doing something like this, i.e., it tries to model the mean-variance relationship and then transforms the data such that it should have a more normal distribution such that the regular microarray tools work. In practice, both approaches tend to give pretty similar results, at least in my hands.

              Comment

              • Simon Anders
                Senior Member
                • Feb 2010
                • 995

                #8
                Hi,

                I've seen this thread only yesterday, and now had a close look at the problem described in the original post. In short, this is a bug: The 'col' argument of 'plotMA' is broken and messes up the assignment of colours to points. (Internally, we subset the 'res' object to get rid of genes with all-zero counts and we forgot to subset 'col', too.) I'll fix this later today.

                Simon

                Comment

                • Simon Anders
                  Senior Member
                  • Feb 2010
                  • 995

                  #9
                  I fixed the issue with the 'col' argument in DESeq 1.12.1. In DESeq2, it was already correct.

                  Comment

                  • Alex234
                    Member
                    • Aug 2013
                    • 31

                    #10
                    Thanks - if I re-load DeSEQ 1 from bioconductor, will it update the copy on my system?

                    Is there any advantage of plotMA over plotDE anyway?


                    Thanks

                    Alex

                    Comment

                    • Simon Anders
                      Senior Member
                      • Feb 2010
                      • 995

                      #11
                      You'll have to wait a day or two for the change to get propagated to the web server (or you download from the SVN server, if you know how to do this).

                      What is plotDE?

                      Comment

                      • Alex234
                        Member
                        • Aug 2013
                        • 31

                        #12
                        I thought it was part of DESeq - dpryan introduced it to me:

                        Originally posted by dpryan View Post
                        Always use the adjusted p-value.

                        The differences look to be simply due to the different scales on the graphs and perhaps the fact that you're using a slightly different coloring/inclusion threshold in each.

                        If you instead did something like:
                        Code:
                        plotDE <- function(res)
                            plot(res$baseMean, res$log2FoldChange, col = ifelse(res$padj>=0.05, "gray69", "red3"), log="x", pch=6, xlim=c(0.1,1e5), ylim=c(-4,4)))
                        plotDE(res)
                        resSig <- res[which(res$padj<0.05),]
                        plotDE(resSig)
                        then the two graphs should be more or less identical. The plotMA function is just a nicer version of the "plotDE" function I pasted above (in fact, if you just type "plotMA", without quotes, you'll see exactly what the function does).

                        Comment

                        Latest Articles

                        Collapse

                        • SEQadmin2
                          Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                          by SEQadmin2



                          CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                          Despite this, “CRISPR helped turn genome editing from a specialized technique into
                          ...
                          07-31-2026, 11:01 AM
                        • SEQadmin2
                          Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                          by SEQadmin2


                          Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                          The systematic characterization of the human proteome has
                          ...
                          07-20-2026, 11:48 AM
                        • SEQadmin2
                          Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                          by SEQadmin2



                          Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                          ...
                          07-09-2026, 11:10 AM

                        ad_right_rmr

                        Collapse

                        News

                        Collapse

                        Topics Statistics Last Post
                        Started by SEQadmin2, 08-06-2026, 07:41 AM
                        0 responses
                        12 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 08-03-2026, 10:13 AM
                        0 responses
                        30 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 07-31-2026, 02:55 AM
                        0 responses
                        39 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 07-24-2026, 12:17 PM
                        0 responses
                        26 views
                        0 reactions
                        Last Post SEQadmin2  
                        Working...