waldronlab / MultiAssayExperiment

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

Fix new("MultiAssayExperiment") #306

Closed hpages closed 2 years ago

hpages commented 2 years ago

@LiNk-NY

Hi Marcel,

With MultiAssayExperiment 1.21.4:

library(MultiAssayExperiment)

mae <- new("MultiAssayExperiment")

validObject(mae)
# Error in validObject(mae) :
#   invalid class “MultiAssayExperiment” object: 1: invalid object for
#     slot "colData" in class "MultiAssayExperiment": got class "S4",
#     should be or extend class "DataFrame"
#   invalid class “MultiAssayExperiment” object: 2: invalid object for
#     slot "sampleMap" in class "MultiAssayExperiment": got class "S4",
#     should be or extend class "DataFrame"

That's because the colData and sampleMap slots contain garbage:

mae@colData
# <S4 Type Object>
# attr(,"elementType")
# [1] "ANY"
# attr(,"elementMetadata")
# `\001NULL\001`
# attr(,"metadata")
# list()

class(mae@colData)
# [1] "S4"

mae@sampleMap
# <S4 Type Object>
# attr(,"elementType")
# [1] "ANY"
# attr(,"elementMetadata")
# `\001NULL\001`
# attr(,"metadata")
# list()

class(mae@sampleMap)
# [1] "S4"

This is breaking the CAGEr package which defines the CAGEext class, an extension of the MultiAssayExperiment class.

With MultiAssayExperiment 1.21.5:

library(MultiAssayExperiment)

mae <- new("MultiAssayExperiment")

validObject(mae)
# [1] TRUE

mae@colData
# DataFrame with 0 rows and 0 columns

class(mae@colData)
# [1] "DFrame"
# attr(,"package")
# [1] "S4Vectors"

mae@sampleMap
# DataFrame with 0 rows and 0 columns

class(mae@sampleMap)
# [1] "DFrame"
# attr(,"package")
# [1] "S4Vectors"

Thanks, H.

sessionInfo():

R Under development (unstable) (2021-10-25 r81105)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 21.10

Matrix products: default
BLAS:   /home/hpages/R/R-4.2.r81105/lib/libRblas.so
LAPACK: /home/hpages/R/R-4.2.r81105/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB              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       

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] MultiAssayExperiment_1.21.5 SummarizedExperiment_1.25.3
 [3] Biobase_2.55.0              GenomicRanges_1.47.5       
 [5] GenomeInfoDb_1.31.1         IRanges_2.29.1             
 [7] S4Vectors_0.33.8            BiocGenerics_0.41.2        
 [9] MatrixGenerics_1.7.0        matrixStats_0.61.0         

loaded via a namespace (and not attached):
 [1] lattice_0.20-45        bitops_1.0-7           grid_4.2.0            
 [4] zlibbioc_1.41.0        XVector_0.35.0         Matrix_1.3-4          
 [7] tools_4.2.0            RCurl_1.98-1.5         DelayedArray_0.21.2   
[10] compiler_4.2.0         GenomeInfoDbData_1.2.7
LiNk-NY commented 2 years ago

Thanks Hervé for debugging and providing a fix!