error in , 'x' must be atomic in affy::boxplot
Entering edit mode
Last seen 4.5 years ago

Dear list,

I'm using affy package for analyzing a dataset (Affymetrix, hgu133plus2). boxplot and hist work fine with raw data. However, after preprocessing with rma, the following error is obtained when using boxplot and hist on normalized data:

celfiles.rma <- rma(celfiles)


Error in, na.last = na.last, decreasing = decreasing, ...) :
  'x' must be atomic
In addition: Warning messages:
1: In : applied to non-(list or vector) of type 'S4'
2: In : applied to non-(list or vector) of type 'S4'

if using oligo::boxplot(celfiles.rma) and oligo::hist(celfiles.rma), everything is fine. However, I have to use affy package for teaching purposes.

Any suggestion on how to fix it so that affy::boxplot and affy::hist can work?



R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] hgu133plus2cdf_2.18.0 hgu133plus2.db_3.2.3    AnnotationDbi_1.34.4  IRanges_2.6.1         S4Vectors_0.10.3      limma_3.28.21        
 [8] genefilter_1.54.2     affy_1.50.0           Biobase_2.32.0        BiocGenerics_0.18.0  

loaded via a namespace (and not attached):
 [1] splines_3.3.2         zlibbioc_1.18.0       xtable_1.8-2          lattice_0.20-34       tools_3.3.2           grid_3.3.2            DBI_0.5-1            
 [8] survival_2.39-4       preprocessCore_1.34.0 affyio_1.42.0         Matrix_1.2-8          bitops_1.0-6          RCurl_1.95-4.8        RSQLite_1.0.0        
[15] BiocInstaller_1.22.3  XML_3.98-1.4          annotate_1.50.1     

affy package boxplot hgu133plus2 oligo package • 3.7k views
Entering edit mode
Last seen 4 hours ago
United States

The affy package doesn't define a boxplot nor a hist function for an ExpressionSet object, which is probably as it should be. The affy package uses ExpressionSet objects, but doesn't define them. All things equal, a boxplot method for ExpressionSets could be defined in Biobase, but it would just look something like

setMethod("boxplot", "ExpressionSet", function(object, ...){

Which is sort of trivial, given that anybody can just do


and be done with it. The density plot is slightly different, but it's still essentially a two-liner

z <- apply(exprs(eset), 2, density)
matplot(sapply(z, "[[", "x"), sapply(z, "[[", y"), type = "l")


Entering edit mode

Dear James,

Thanks for your quick and useful reply. Yes, you are right: affy does not define a boxplot nor a hist function for an expression set object. However, I've used boxplot and hist with normalized objects before (same type of microarray). In fact, before asking this question, I've tried with another dataset for which I knew it worked.

That's why I was wondering why it worked for one dataset and not for another ;-)

Entering edit mode

I'm not sure I understand. Are you saying that these functions were defined in the affy package in the past? Or that you can generate boxplots and/or density plots using ExpressionSets generated from one type of array, but not another?

Note that the affy package has been more or less a static package since the late 2000's. There have been some bugfixes and whatnot, but no active development. So if there ever was a boxplot method for ExpressionSets that was subsequently removed, it had to have happened years ago. I checked through the SVN logs, and I can only find evidence for boxplot and hist being defined for AffyBatch objects. I did find that Martin Morgan removed the generic boxplot method and put it in BiocGenerics, but that was the generic, not a method. And the whole bit that he took out looks like this:

### ======================================================================
### The boxplot() generic
### ---------------------------------------------------------------------
### graphics::boxplot is an S3 generic.


There are other packages that defines a boxplot method on ExpressionSets, and you might have had that package loaded when it worked for you. For example, the oligo, affyPLM, and lumi packages all have boxplot methods defined for ExpressionSets.

Entering edit mode

Thanks James,

What a mistake. affyPLM was loaded in the script in which boxplot worked well for the normalized data. But it was not loaded in the other script where boxplot fails...that was the point: boxplot method from affyPLM was the one working.

Thanks again and apologize for this mess. I'm ashamed of myself. Sorry for wasting your time.




Login before adding your answer.

Traffic: 401 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6