[Bioc-devel] do SummarizedExperiments really need colnames?

Peter Hickey peter.hickey at gmail.com
Mon Dec 7 01:56:28 CET 2015


While on the topic of SummarizedExperiment colnames, the circumstances in
which these are stripped from the assays and overridden by colData is
confusing to me, particularly case 2 below (a warning in case 3 might be
useful too).

> m1 <- matrix(1:10, ncol = 2)
> m2 <- m1
> colnames(m2) <- c("A", "B")
>
> se1 <- SummarizedExperiment(m1, colData = DataFrame(row.names = c("A",
"B")))
> se2 <- SummarizedExperiment(m2)
> se3 <- SummarizedExperiment(m2, colData = DataFrame(row.names = c("C",
"D")))
>
> # colnames correctly set to c("A", "B") and stripped from assays
> colnames(se1)
[1] "A" "B"
> se1 at assays[[1]]
[,1] [,2]
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10
> # colnames correctly set to c("A", "B") set and but not stripped from
assays
> colnames(se2)
[1] "A" "B"
> se2 at assays[[1]]
A B
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10
> # colnames set to c("C", "D") (without warning about mismatch) and
stripped
> # from assays
> se3 at assays[[1]]
[,1] [,2]
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10

> sessionInfo()
R Under development (unstable) (2015-11-28 r69714)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

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

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

other attached packages:
[1] SummarizedExperiment_1.1.5 Biobase_2.31.1
[3] GenomicRanges_1.23.4 GenomeInfoDb_1.7.3
[5] IRanges_2.5.9 S4Vectors_0.9.11
[7] BiocGenerics_0.17.2

loaded via a namespace (and not attached):
[1] zlibbioc_1.17.0 XVector_0.11.1

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list