[Bioc-devel] do SummarizedExperiments really need colnames?
Aaron Lun
alun at wehi.edu.au
Sat Dec 5 13:36:47 CET 2015
Hello all,
At the start of the SummarizedExperiment constructor, there's a code
block that throws an error if 'colData' is not specified and the assay
matrices don't have column names.
Is this really necessary? In many cases, I just want to get a matrix
into the SE0 object without having to worry about column names. It
doesn't seem like there's a requirement for this in the SE0 class,
either; it seems happy with 'colnames(se0) <- NULL', and setting
'colData' to a 'DataFrame' with 'NULL' row names doesn't break the
constructor.
The requirement for column names causes issues for some manipulations -
for example:
out <- SummarizedExperiment(matrix(0, 10, 5),
colData=DataFrame(row.names=1:5))
out[,1] <- out[,2]
## Error in `rownames<-`(`*tmp*`, value = c("2", "2", "3", "4", "5")) :
## duplicate rownames not allowed
While this is fair enough, it's a bit annoying if I didn't want or need
the names in the first place.
The error mentioned above precedes the construction of the missing
'colData', so if column names are missing, then a more general way to
construct the 'colData' would to do 'new("DataFrame", nrows=ncol(assays))'.
Cheers,
Aaron
More information about the Bioc-devel
mailing list