Search
Question: PlotMA Error_Coercing to a vector
2
gravatar for Jessica Chen
2.6 years ago by
Jessica Chen20
United States
Jessica Chen20 wrote:

Hi, 

I tried use DESeq2's PlotMA function and got the following error message - 

> plotMA(resKD_fc1)
Error in as.vector(data):
no method for coercing this S4 class to a vector

How do i resolve this issue? And what does it mean? 

 

 

The sessionInfo is as follows - 

> sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

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] grid      parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] gridExtra_0.9.1           gProfileR_0.5.3           pheatmap_1.0.2            RColorBrewer_1.1-2       
 [5] gplots_2.17.0             Biobase_2.26.0            edgeR_3.8.6               limma_3.22.7             
 [9] DESeq2_1.6.3              RcppArmadillo_0.5.100.1.0 Rcpp_0.11.6               GenomicRanges_1.18.4     
[13] GenomeInfoDb_1.2.5        IRanges_2.0.1             S4Vectors_0.4.0           BiocGenerics_0.12.1      
[17] ggdendro_0.1-15           ggplot2_1.0.1             BiocInstaller_1.16.4     

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3      annotate_1.44.0      AnnotationDbi_1.28.2 base64enc_0.1-2      BatchJobs_1.6       
 [6] BBmisc_1.9           BiocParallel_1.0.3   bitops_1.0-6         brew_1.0-6           caTools_1.17.1      
[11] checkmate_1.5.2      cluster_2.0.1        codetools_0.2-11     colorspace_1.2-6     DBI_0.3.1           
[16] digest_0.6.8         fail_1.2             foreach_1.4.2        foreign_0.8-63       Formula_1.2-1       
[21] gdata_2.16.1         genefilter_1.48.1    geneplotter_1.44.0   gtable_0.1.2         gtools_3.4.2        
[26] Hmisc_3.16-0         iterators_1.0.7      KernSmooth_2.23-14   labeling_0.3         lattice_0.20-31     
[31] latticeExtra_0.6-26  locfit_1.5-9.1       magrittr_1.5         MASS_7.3-40          munsell_0.4.2       
[36] nnet_7.3-9           plyr_1.8.2           proto_0.3-10         RCurl_1.95-4.6       reshape2_1.4.1      
[41] rpart_4.1-9          RSQLite_1.0.0        scales_0.2.4         sendmailR_1.2-1      splines_3.1.3       
[46] stringi_0.4-1        stringr_1.0.0        survival_2.38-1      tools_3.1.3          XML_3.98-1.1        
[51] xtable_1.7-4         XVector_0.6.0    

 

Additional information about the dataset are --

> mcols(resKD_fc1, use.names=TRUE)
DataFrame with 6 rows and 2 columns
                       type                                                          description
                <character>                                                          <character>
baseMean       intermediate                            mean of normalized counts for all samples
log2FoldChange      results log2 fold change (MAP): sampletypeMOV10_knockdown vs sampletypesiRNA
lfcSE               results         standard error: sampletypeMOV10_knockdown vs sampletypesiRNA
stat                results         Wald statistic: sampletypeMOV10_knockdown vs sampletypesiRNA
pvalue              results      Wald test p-value: sampletypeMOV10_knockdown vs sampletypesiRNA
padj                results                                                 BH adjusted p-values

> class(resKD)
[1] "DESeqResults"
attr(,"package")
[1] "DESeq2"
ADD COMMENTlink modified 2.5 years ago • written 2.6 years ago by Jessica Chen20
0
gravatar for Michael Love
2.6 years ago by
Michael Love15k
United States
Michael Love15k wrote:

Interesting. I can't tell yet what might be the issue here because all the relevant packages seem to be on the same version.

can you call traceback() right after the error?

And just to check that there are in fact rows in this object:

head(resKD_fc1)

 

ADD COMMENTlink written 2.6 years ago by Michael Love15k
0
gravatar for Jessica Chen
2.5 years ago by
Jessica Chen20
United States
Jessica Chen20 wrote:

 

When I try to initialize edgeR at the start of a R session, i get the following message -- 

> library(edgeR)
Loading required package: limma

Attaching package: ‘limma’

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

    plotMA

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

    plotMA

 

Following the error, the commands traceback() and head() outputs the following --

> traceback()
6: as.vector(data)
5: array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), 
       NULL) else NULL)
4: as.matrix.default(object)
3: as.matrix(object)
2: plotMA.default(resOE_fc1)
1: plotMA(resOE_fc1)

> head(resKD_fc1)
log2 fold change (MAP): sampletypeMOV10_knockdown vs sampletypesiRNA 
Wald test p-value: sampletypeMOV10_knockdown vs sampletypesiRNA 
DataFrame with 6 rows and 6 columns
               baseMean log2FoldChange     lfcSE      stat    pvalue      padj
              <numeric>      <numeric> <numeric> <numeric> <numeric> <numeric>
1/2-SBSRNA4  45.6520399   -0.021356738 0.1951928         0         1         1
A1BG         61.0931017   -0.326500971 0.1842414         0         1         1
A1BG-AS1    175.6658069   -0.032535702 0.1318442         0         1         1
A1CF          0.2376919    0.030733638 0.0423651         0         1        NA
A2LD1        89.6179845    0.178493329 0.1683009         0         1         1
A2M           5.8600841    0.006373802 0.1754435         0         1         1
ADD COMMENTlink written 2.5 years ago by Jessica Chen20
1

hi Jessica,

This is because limma is masking the name which is used by DESeq2 for this function. because limma was loaded after DESeq2, when you type

plotMA(x)

it goes to the limma function to look for the code for plotting 'x'. You should be able to avoid this with:

DESeq2::plotMA(x)

Or by loading edgeR before loading DESeq2.

ADD REPLYlink written 2.5 years ago by Michael Love15k
0
gravatar for Jessica Chen
2.5 years ago by
Jessica Chen20
United States
Jessica Chen20 wrote:

That solved the issue. Thank you very much! 

ADD COMMENTlink written 2.5 years ago by Jessica Chen20

I had the same kind of problem and this answer fixed it as well. Awesome!

ADD REPLYlink written 2.2 years ago by sjorsvanheuveln0
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 2.2.0
Traffic: 179 users visited in the last hour