Closed LTLA closed 5 years ago
With unnamed columns, the MAE class has no way to map ExperimentList
columns back to colData
rows. In most situations, the constructor throws a warning when it drops columns that can't be mapped to colData
, e.g.:
suppressPackageStartupMessages(library(MultiAssayExperiment))
se2 <- SummarizedExperiment(list(counts=matrix(rpois(1000, lambda=10), ncol=10)))
colnames(se2) <- LETTERS[1:10]
cd2 <- DataFrame(pheno=1:9, row.names = LETTERS[1:9])
mae2 <- MultiAssayExperiment(experiments=list(genes=se2), colData = cd2)
#> Warning in .sampleMapFromData(colData, experiments): Data from rows:
#> NA - J
#> dropped due to missing phenotype data
ncol(se2)
#> [1] 10
ncol(mae2[[1]])
#> [1] 9
But you seem to have found a corner case where it does not...
I think the current behavior is correct, given that the warning message is added. For the constructor to handle it internally would require making up column names for this SummarizedExperiment, which might be too hands-on and potentially create gotchas - e.g. what if you had specified colData
, and it made up colnames that happened to match rownames of the specified colData
? For that reason, unless I hear a better counter-argument, I would stick with the remove-and-warn approach.
I'd be happy with a noisy warning.
Consider the following sequence of reasonable events.
Where doth my columns go? It looks like I have to actually name them:
Well, okay, but it would be nice to have that either (i) handled internally somehow or (ii) have
MultiAssayExperiment()
spit out an error if there are no names.Session info
``` R Under development (unstable) (2019-11-04 r77366) Platform: x86_64-apple-darwin17.7.0 (64-bit) Running under: macOS High Sierra 10.13.6 Matrix products: default BLAS: /Users/luna/Software/R/trunk/lib/libRblas.dylib LAPACK: /Users/luna/Software/R/trunk/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets [8] methods base other attached packages: [1] MultiAssayExperiment_1.13.0 SummarizedExperiment_1.17.0 [3] DelayedArray_0.13.0 BiocParallel_1.21.0 [5] matrixStats_0.55.0 Biobase_2.47.0 [7] GenomicRanges_1.39.1 GenomeInfoDb_1.23.0 [9] IRanges_2.21.1 S4Vectors_0.25.0 [11] BiocGenerics_0.33.0 loaded via a namespace (and not attached): [1] lattice_0.20-38 bitops_1.0-6 grid_4.0.0 [4] zlibbioc_1.33.0 XVector_0.27.0 Matrix_1.2-17 [7] tools_4.0.0 RCurl_1.95-4.12 compiler_4.0.0 [10] GenomeInfoDbData_1.2.2 ```