waldronlab / MultiAssayExperiment

Bioconductor package for management of multi-assay data
https://waldronlab.io/MultiAssayExperiment/
69 stars 32 forks source link

Assigning to metadata causes endless duplication of `drop.experiments` #323

Closed LTLA closed 1 year ago

LTLA commented 1 year ago
library(MultiAssayExperiment)
example(MultiAssayExperiment)
metadata(mae)
## list()

mae <- mae[,,"Affy"]
metadata(mae)
## $drops.experiments
## [1] "Methyl450k" "RNASeqGene" "GISTIC"

metadata(mae)$foo <- 1
names(metadata(mae))
## [1] "drops.experiments" "foo"               "drops.experiments"

metadata(mae)$foo <- 1
names(metadata(mae))
## [1] "drops.experiments" "foo"               "drops.experiments"
## [4] "drops.experiments"

metadata(mae)$foo <- 1
names(metadata(mae))
## [1] "drops.experiments" "foo"               "drops.experiments"
## [4] "drops.experiments" "drops.experiments"

Examining your metadata,MultiAssayExperiment-method reveals some silly stuff that leads to the above outcome. If you insist on adding a drop.experiments vector - which is not an obvious need, why are you cluttering my object with useless historical garbage when I explicitly removed these experiments? - just do it the normal way and put it in metadata() as a full-fledged element, rather than trying to sneak it in dynamically via an override to metadata(). Experience with similar scenarios for the SingleCellExperiment show that such overrides rarely work as expected.

Session information ``` R Under development (unstable) (2022-11-21 r83371) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.6 LTS Matrix products: default BLAS: /usr/local/lib/R/lib/libRblas.so LAPACK: /usr/local/lib/R/lib/libRlapack.so locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: Etc/UTC tzcode source: system (glibc) attached base packages: [1] stats4 stats graphics grDevices utils datasets methods [8] base other attached packages: [1] MultiAssayExperiment_1.25.7 SummarizedExperiment_1.29.1 [3] Biobase_2.59.0 GenomicRanges_1.51.4 [5] GenomeInfoDb_1.35.15 IRanges_2.33.0 [7] S4Vectors_0.37.4 BiocGenerics_0.45.0 [9] MatrixGenerics_1.11.0 matrixStats_0.63.0 loaded via a namespace (and not attached): [1] BiocBaseUtils_1.1.0 zlibbioc_1.45.0 Matrix_1.5-3 [4] lattice_0.20-45 GenomeInfoDbData_1.2.9 XVector_0.39.0 [7] RCurl_1.98-1.10 bitops_1.0-7 grid_4.3.0 [10] DelayedArray_0.25.0 compiler_4.3.0 tools_4.3.0 ```
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

LiNk-NY commented 1 year ago

Closed in 4ca8ca3a3e5b02bb2393a73c7c12e11a8589a98a