[Bioc-devel] Empty DataFrame Causes SummarizedExperiment Constructor Error

Dario Strbenac d@tr7320 @end|ng |rom un|@@ydney@edu@@u
Fri May 12 16:00:05 CEST 2023

Good day,

The default value of colData is DataFrame(). Not specifying an informative colData is fine.

countsMini <- matrix(rpois(100, 100), ncol = 10)
colnames(countsMini) <- paste("Cell", 1:10)
rownames(countsMini) <- paste("Gene", 1:10)
SummarizedExperiment(assays = list(counts = countsMini)) # Creates the object successfully.

But, explicitly specifying an empty DataFrame triggers an error. I don't understand why it is not equivalent to the constructor's default.

SummarizedExperiment(assays = list(counts = countsMini), colData = DataFrame())
Error in `rownames<-`(`*tmp*`, value = .get_colnames_from_first_assay(assays)) : 
  invalid rownames length

What is the subtle difference? It also seems like there could be a clearer error message emitted if this is caught in the right place.

Dario Strbenac
University of Sydney
Camperdown NSW 2050

More information about the Bioc-devel mailing list