A quality-of-life improvement for the MAE constructor would be to infer an appropriate colData= value from sampleMap= if the former is not explicitly supplied. For example:
library(MultiAssayExperiment)
# Making up some data.
mat <- matrix(rpois(10000, 5), nrow=10)
rownames(mat) <- paste0("CD", seq_len(nrow(mat))) # made-up markers
colnames(mat) <- paste0("BARCODE_", seq_len(ncol(mat))) # made-up barcodes
# First building the SE. Assuming that barcodes come from a range of donors.
donor <- rep(LETTERS[1:10], each=100)
se <- SummarizedExperiment(list(counts=mat))
se$Donor <- donor
# Now building the MAE. Each 'column' of the MAE corresponds to a donor;
# this is specified by the sample mapping from donors (primary) to barcodes (colname).
mae <- MultiAssayExperiment(list(markers=se),
sampleMap=data.frame(assay="markers", primary=se$Donor, colname=colnames(se)),
colData=DataFrame(row.names=LETTERS[1:10])
)
Basically, I would like to avoid having to set the final colData=, given that the row names for a sensible default could easily be inferred from unique(sampleMap$primary). So basically, I would like to get the same results from the code below:
mae <- MultiAssayExperiment(list(markers=se),
sampleMap=data.frame(assay="markers", primary=se$Donor, colname=colnames(se))
)
Though right now I get an MAE with all columns stripped:
## harmonizing input:
## removing 1000 sampleMap rows with 'primary' not in colData
## removing 1000 colData rownames not in sampleMap 'primary'
causing me to scratch my head for a minute and wonder what I did wrong.
A quality-of-life improvement for the MAE constructor would be to infer an appropriate
colData=
value fromsampleMap=
if the former is not explicitly supplied. For example:Basically, I would like to avoid having to set the final
colData=
, given that the row names for a sensible default could easily be inferred fromunique(sampleMap$primary)
. So basically, I would like to get the same results from the code below:Though right now I get an MAE with all columns stripped:
causing me to scratch my head for a minute and wonder what I did wrong.