[Bioc-devel] requirement for named assays in SummarizedExperiment

Aaron Lun alun at wehi.EDU.AU
Fri Mar 6 08:09:09 CET 2015

Dear all,

I stumbled upon some unexpected behaviour with cbind'ing
SummarizedExperiment objects with unnamed assays:

> require(GenomicRanges)
> nrows <- 5; ncols <- 4
> counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
> rowData <- GRanges("chr1", IRanges(1:nrows, 1:nrows))
> colData <- DataFrame(Treatment=1:ncols, row.names=LETTERS[1:ncols])
> sset <- SummarizedExperiment(counts, rowData=rowData, colData=colData)
> sset
class: SummarizedExperiment 
dim: 5 4 
assays(1): ''
rownames: NULL
rowData metadata column names(0):
colnames(4): A B C D
colData names(1): Treatment
> cbind(sset, sset)
dim: 5 8 
rownames: NULL
rowData metadata column names(0):
colnames(8): A B ... C1 D1
colData names(1): Treatment

Upon cbind'ing, the assays in the SE object are lost. I think this is
due to the fact that the cbind code matches up assays by their names.
Thus, if there are no names, the code assumes that there are no assays.

I guess this could be prevented by enforcing naming of assays in the
SummarizedExperiment constructor. Or, the binding code could be modified
to work positionally when there are no assay names, e.g., by cbind'ing
the first assays across all SE objects, then the second assays, etc. 

Any thoughts?



> sessionInfo()
R Under development (unstable) (2014-12-14 r67167)
Platform: x86_64-unknown-linux-gnu (64-bit)

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

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

other attached packages:
[1] GenomicRanges_1.19.42 GenomeInfoDb_1.3.13   IRanges_2.1.41       
[4] S4Vectors_0.5.21      BiocGenerics_0.13.6  

loaded via a namespace (and not attached):
[1] XVector_0.7.4

The information in this email is confidential and intend...{{dropped:4}}

More information about the Bioc-devel mailing list