Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • DESeq2 Problems with MA-Plot

    Hello,

    I am getting an error when I try to do MA-Plot function in DESeq2. My data input is a simple file of the following headers, "GeneName", "Treat1Rep1_RawCounts", Treat1Rep2_RawCounts"....."Treat4Rep2_RawCounts", "Treat4Rep3_RawCounts". I have 4 conditions, 3 reps each, so 12 different raw counts for each gene ID.

    I can import the data in fine and get to the results of the DESeq function. Here is my script below:

    > countsTable<-read.delim("merged_raw_counts.txt",header=T)
    > rownames(countsTable)<-countsTable$Name
    > countsTable<-countsTable[,-1]
    > head(countsTable)
    T0R1 T0R2 T0R3 T0S1 T0S2 T0S3 T1R1 T1R2 T1R3 T1S1 T1S2 T1S3
    gene01g00010 0 5 2 3 4 6 4 1 0 7 1 1
    gene01g00020 1 0 12 0 6 2 3 3 1 2 0 0
    gene01g00030 0 0 0 0 0 0 0 0 0 1 0 0
    gene01g00040 0 0 0 0 0 0 0 0 0 0 0 0
    gene01g00050 0 0 0 1 0 0 0 0 0 0 0 0
    gene01g00060 13 99 77 109 76 82 82 140 115 157 72 118
    >countData<-matrix(countsTable)
    >colData<-data.frame(condition=factor(c("T0R","T0R","T0R","T0S","T0S","T0S","T1R","T1R","T1R","T1S","T1S","T1S")))
    >dds<-DESeqDataSetFromMatrix(countData=countsTable,colData,formula(~condition))
    Usage note: the following factors have 3 or more levels:

    condition

    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)$condition<-factor(colData(dds)$condition,levels=c("T0R","T0S","T1R","T1S"))
    > dds
    class: DESeqDataSet
    dim: 34903 12
    exptData(0):
    assays(1): counts
    rownames(34903): gene01g00010 gene01g00020 ... gene00g99390 gene00g99400
    rowData metadata column names(0):
    colnames(12): 1 2 ... 11 12
    colData names(1): condition
    > dds<-DESeq(dds)
    > res<-results(dds)
    > res<-res[order(res$padj),]
    > head(res)
    DataFrame with 6 rows and 6 columns
    baseMean log2FoldChange lfcSE stat pvalue padj
    <numeric> <numeric> <numeric> <numeric> <numeric> <numeric>
    gene00g04520 13076.372 5.050936 0.17241390 29.29541 1.186570e-188 3.046400e-184
    gene03g01180 9750.315 3.897496 0.13548892 28.76616 5.687327e-182 7.300822e-178
    gene00g09910 4133.619 2.299451 0.08051913 28.55783 2.245862e-179 1.869130e-175
    gene00g48700 1329.461 -2.640605 0.09249464 -28.54874 2.912098e-179 1.869130e-175
    gene04g12160 12921.588 3.599922 0.12872185 27.96667 4.133827e-172 2.122638e-168
    gene00g46890 25040.714 4.235810 0.15466115 27.38768 3.845523e-165 1.645499e-161

    Up to this point I don't have any problems. However when I do:
    > plotMA(dds,ylim=c(-2,2),main="DESeq2")

    I get:
    Error in plotMA(dds, ylim = c(-2, 2), main = "DESeq2") :
    'x' must be a data frame with columns named 'baseMean', 'log2FoldChange'.

    My apologies if I posted too much background info. I'd figured my error is in something I did in early steps.

    Thanks for any help on this.

    -Will

  • #2
    Code:
    plotMA(res, ylim=c(-2,2),main="DESeq2")

    Comment


    • #3
      hi Will,

      can you include the sessionInfo() output?

      In Bioc 2.13, the plotMA function became a generic defined in the geneplotter package for data.frame, and we transitioned plotMA to an S4 method in DESeq2 which is defined for DESeqDataSet objects (and in DESeq2 version >= 1.3 it also defined for the object returned by results(), a DESeqResults object).

      I think if you update the geneplotter package, it might solve your error:

      biocLite("geneplotter")

      Comment


      • #4
        Originally posted by spujr View Post
        Hello,



        My apologies if I posted too much background info. I'd figured my error is in something I did in early steps.

        Thanks for any help on this.

        -Will
        Hopefully anyone can help this
        So sorry can't
        Good luck sir
        http://watchfree.me/10/w.png

        Comment


        • #5
          Hi,

          Thanks for your responses. I thought I updated everything but found out this wasn't the case. Once I followed Michael's suggestion the problem was resolved.

          Thanks again!

          Comment


          • #6
            I am also having a problem with the plotMA function in DESeq2 1.3

            First I got this error message:
            > plotMA(res, main="DESeq2", ylim=c(-2,2))
            Error in as.vector(data) :
            no method for coercing this S4 class to a vector

            So I updated geneplotter, and I got this error message:

            > plotMA(res,ylim=c(-2,2),main="DESeq2")
            Error in plotMA(res, ylim = c(-2, 2), main = "DESeq2") :
            Error from the generic function 'plotMA' defined in package 'BiocGenerics': no S4 method definition for argument 'res' of class 'DataFrame' was found. Did you perhaps mean calling the function 'plotMA' from another package, e.g. 'limma'? In that case, please use the syntax 'limma:lotMA'.

            Comment


            • #7
              hi,

              These function definition problems are all due to package versions (either out of date packages, or using syntax from the vignettes of newer versions with older versions of software), so I can't provide much help unless you include the full output of sessionInfo() with your question.

              Comment


              • #8
                Hello all,
                This seems to be my problem as well ! I have tried plotMA on DESeq and DESeq2 but I get this same error as mentioned by cacti: Here is my session info . hopefully there is something someone can figure out for me! I am desperately trying to ge tthis plot! I plotted plotDE and it works fine . JUst the plotMA is the problem. Thanks in advance !BTW I checked on the function in DESeq2 vignette and it seems to be what I used , no changes.
                > sessionInfo()
                R version 3.0.1 (2013-05-16)
                Platform: i386-w64-mingw32/i386 (32-bit)

                locale:
                [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] grDevices datasets parallel stats graphics utils methods
                [8] base

                other attached packages:
                [1] DESeq2_1.2.10 RcppArmadillo_0.4.100.2.1
                [3] Rcpp_0.11.1 GenomicRanges_1.14.4
                [5] XVector_0.2.0 IRanges_1.20.7
                [7] DESeq_1.14.0 lattice_0.20-15
                [9] locfit_1.5-9.1 Biobase_2.22.0
                [11] BiocGenerics_0.8.0 BiocInstaller_1.12.0

                loaded via a namespace (and not attached):
                [1] annotate_1.40.1 AnnotationDbi_1.24.0 DBI_0.2-7
                [4] genefilter_1.44.0 geneplotter_1.40.0 grid_3.0.1
                [7] RColorBrewer_1.0-5 RSQLite_0.11.4 splines_3.0.1
                [10] stats4_3.0.1 survival_2.37-7 tools_3.0.1
                [13] XML_3.98-1.1 xtable_1.7-3
                I also loaded my previous workspace and updated geneplotter and this is what I got:
                > plotMA(dseq,pvalCutoff=.05,ylim=c(-2,2))
                Error in (function (classes, fdef, mtable) :
                unable to find an inherited method for function ‘extractROWS’ for signature ‘"list"’

                Thanks very much
                geneart.

                Comment


                • #9
                  Hi Michael, I just started a new session and tried to load DESeq2 1.3.59 but I got this error:

                  > library("DESeq2")
                  Error in dyn.load(file, DLLpath = DLLpath, ...) :
                  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/DESeq2/libs/DESeq2.so':
                  dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/DESeq2/libs/DESeq2.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.1/Resources/lib/libRlapack.dylib
                  Referenced from: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/DESeq2/libs/DESeq2.so
                  Reason: Incompatible library version: DESeq2.so requires version 3.1.0 or later, but libRlapack.dylib provides version 3.0.0
                  In addition: Warning message:
                  package ‘DESeq2’ was built under R version 3.1.0
                  Error: package or namespace load failed for ‘DESeq2’

                  Here is my session info:

                  > sessionInfo()
                  R version 3.0.3 (2014-03-06)
                  Platform: x86_64-apple-darwin10.8.0 (64-bit)

                  locale:
                  [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

                  other attached packages:
                  [1] limma_3.18.13 gplots_2.12.1 goseq_1.14.0
                  [4] geneLenDataBase_0.99.12 BiasedUrn_1.06.1 geneplotter_1.40.0
                  [7] annotate_1.40.1 AnnotationDbi_1.24.0 lattice_0.20-27
                  [10] Biobase_2.22.0 gdata_2.13.2 biomaRt_2.18.0
                  [13] BiocInstaller_1.12.0 RcppArmadillo_0.4.100.2.1 Rcpp_0.11.1
                  [16] GenomicRanges_1.14.4 XVector_0.2.0 IRanges_1.20.7
                  [19] BiocGenerics_0.8.0

                  loaded via a namespace (and not attached):
                  [1] Biostrings_2.30.1 bitops_1.0-6 BSgenome_1.30.0
                  [4] caTools_1.16 DBI_0.2-7 genefilter_1.44.0
                  [7] GenomicFeatures_1.14.5 grid_3.0.3 gtools_3.3.1
                  [10] KernSmooth_2.23-10 locfit_1.5-9.1 Matrix_1.1-2
                  [13] mgcv_1.7-28 nlme_3.1-113 RColorBrewer_1.0-5
                  [16] RCurl_1.95-4.1 Rsamtools_1.14.3 RSQLite_0.11.4
                  [19] rtracklayer_1.22.6 splines_3.0.3 stats4_3.0.3
                  [22] survival_2.37-7 tools_3.0.3 XML_3.95-0.2
                  [25] xtable_1.7-3 zlibbioc_1.8.0


                  This information may also be helpful. I received this message when installing limma...
                  > library("limma", lib.loc="/Library/Frameworks/R.framework/Versions/3.0/Resources/library")

                  Attaching package: ‘limma’

                  The following object is masked from ‘package:geneplotter’:

                  plotMA

                  The following object is masked from ‘package:BiocGenerics’:

                  plotMA

                  Comment


                  • #10
                    hi geneart,

                    You are using DESeq2 v1.2, in which plotMA() can only take a DESeqDataSet object. so this should work:

                    plotMA(dds)

                    There's always a bit of confusion because google might direct our users to the development vignettes online, and then ending up with code for the wrong version. It's preferable to load the man pages and vignettes within R, to make sure you get the proper documentation:

                    ?plotMA
                    vignettes("DESeq2")

                    plotMA() taking the object returned by results() was a switch we made in the devel branch (DESeq2 v1.3), which makes more sense IMO than taking the DESeqDataSet but i didn't realize this until after 1.2 was released.


                    hi cacti,

                    You are using the devel version of DESeq2 which was built with R-devel (R version 3.1.0), but it looks like you are running R version 3.0.3. The devel version of our package will be released as DESeq2 v1.4 on April 14.

                    i'd suggest continuing to use the version of the package which is installed by biocLite("DESeq2"), and if this is version 1.2 then you can provide the DESeqDataSet to plotMA:

                    plotMA(dds)

                    Mike

                    Comment


                    • #11
                      Thanks Mike, I was just excited to try the new version of DESeq2 as I am analyzing a factor with three levels. I had used betaPrior=False when calling DESeq() but I'm curious to see if my results differ using the new version.

                      Comment


                      • #12
                        EDIT: Bioconductor packages should be installed following this advice:
                        http://bioconductor.org/install/


                        ah, I see. Yes, we like to have devel testers as well, because we shouldn't push changes to the release that aren't show-stopping bugs. Without devel testers, we should wait 6 months to push subtle improvements.

                        The p-values shouldn't change much with or without LFC shrinkage, but the effects should be more interpretable, i.e., large absolute LFC is likely meaningful.
                        Last edited by Michael Love; 07-30-2014, 05:31 AM. Reason: dont recommend own install

                        Comment


                        • #13
                          DESeq2 plotMA()

                          Thanks very much Mike !
                          Will definitely try out what you said and will update soon
                          Regards
                          geneart.

                          Comment


                          • #14
                            Hi!

                            I've got a similar problem with plotMA in DESeq2. Here is my session info:

                            R version 3.0.2 (2013-09-25)
                            Platform: i386-w64-mingw32/i386 (32-bit)

                            locale:
                            [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252
                            [4] LC_NUMERIC=C LC_TIME=Spanish_Spain.1252

                            attached base packages:
                            [1] grid splines parallel stats graphics grDevices utils datasets methods
                            [10] base

                            other attached packages:
                            [1] BiocInstaller_1.12.0 VennDiagram_1.6.5 NOISeq_2.6.0
                            [4] TCC_1.2.0 ROC_1.38.0 baySeq_1.16.0
                            [7] DESeq_1.14.0 lattice_0.20-29 locfit_1.5-9.1
                            [10] Biobase_2.22.0 DESeq2_1.2.10 RcppArmadillo_0.4.100.2.1
                            [13] Rcpp_0.11.1 GenomicRanges_1.14.4 XVector_0.2.0
                            [16] IRanges_1.20.7 BiocGenerics_0.8.0 edgeR_3.4.2
                            [19] limma_3.18.13

                            loaded via a namespace (and not attached):
                            [1] annotate_1.40.1 AnnotationDbi_1.24.0 DBI_0.2-7 EBSeq_1.2.0
                            [5] genefilter_1.44.0 geneplotter_1.40.0 RColorBrewer_1.0-5 RSQLite_0.11.4
                            [9] samr_2.0 stats4_3.0.2 survival_2.37-7 tools_3.0.2
                            [13] XML_3.98-1.1 xtable_1.7-3


                            My DESeq2 script is like this:

                            index.groups <- as.factor( "A","B")))
                            coldat=DataFrame(grp=factor(index.groups), each=1)
                            dds <- DESeqDataSetFromMatrix(raw_filter, colData=coldat, design =~grp)
                            dds <- DESeq(dds)
                            deseq2.res <- results(dds)
                            deseq2.res <- deseq2.res[order(deseq2.res$padj<0.05),]
                            deseq2.fc=deseq2.res$log2FoldChange
                            names(deseq2.fc)=rownames(deseq2.res)
                            exp.fc=deseq2.fc
                            out.suffix="deseq2"
                            head(exp.fc)
                            head(deseq2.res)
                            resultsNames(dds)

                            So far it works fine, but when I'm using plotMA(dds) appears the following error message:

                            Error in plotMA(dds) :
                            'x' must be a data frame with columns named 'baseMean', 'log2FoldChange'.


                            (I think that all my packages are updated)

                            Comment


                            • #15
                              Hi Beth,

                              I think it may be that geneplotter or another package is masking plotMA because it was loaded after.

                              Try:

                              Code:
                              DESeq2::plotMA(dds)
                              (this was the reason why we made plotMA a method in Bioc 2.14 which we could dispatch on different classes of objects)
                              Last edited by Michael Love; 04-05-2014, 05:58 AM.

                              Comment

                              Latest Articles

                              Collapse

                              • seqadmin
                                Strategies for Sequencing Challenging Samples
                                by seqadmin


                                Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                                03-22-2024, 06:39 AM
                              • seqadmin
                                Techniques and Challenges in Conservation Genomics
                                by seqadmin



                                The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                                Avian Conservation
                                Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                                03-08-2024, 10:41 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by seqadmin, Yesterday, 06:37 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, Yesterday, 06:07 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, 03-22-2024, 10:03 AM
                              0 responses
                              50 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, 03-21-2024, 07:32 AM
                              0 responses
                              67 views
                              0 likes
                              Last Post seqadmin  
                              Working...
                              X