drisso / SingleCellExperiment

Clone of the Bioconductor repository for the SingleCellExperiment package, see https://bioconductor.org/packages/devel/bioc/html/SingleCellExperiment.html for the official development version.
63 stars 17 forks source link

Rownames stripped when using `reducedDims<-` #46

Closed LiNk-NY closed 4 years ago

LiNk-NY commented 4 years ago

Hi Davide, @drisso Aaron, @LTLA Is this something that should be supported?

suppressPackageStartupMessages( library(SingleCellExperiment) )
example(SingleCellExperiment, echo = FALSE)
scle <- as(se, 'SingleCellExperiment')
res <- list(pca = matrix(1:100, nrow = 100, dimnames = list(paste0("F", 1:100), "A1")))
reducedDims(scle) <- res
head(reducedDims(scle)[[1]])
#>      A1
#> [1,]  1
#> [2,]  2
#> [3,]  3
#> [4,]  4
#> [5,]  5
#> [6,]  6
sessionInfo()
#> R Under development (unstable) (2020-03-12 r77934)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 19.10
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
#> 
#> 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       
#> 
#> attached base packages:
#> [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
#> [8] methods   base     
#> 
#> other attached packages:
#>  [1] SingleCellExperiment_1.9.2  SummarizedExperiment_1.17.3
#>  [3] DelayedArray_0.13.5         BiocParallel_1.21.2        
#>  [5] matrixStats_0.56.0          Biobase_2.47.2             
#>  [7] GenomicRanges_1.39.2        GenomeInfoDb_1.23.13       
#>  [9] IRanges_2.21.3              S4Vectors_0.25.12          
#> [11] BiocGenerics_0.33.0         nvimcom_0.9-83             
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.3             knitr_1.28             XVector_0.27.0        
#>  [4] magrittr_1.5           zlibbioc_1.33.1        lattice_0.20-40       
#>  [7] rlang_0.4.5            stringr_1.4.0          highr_0.8             
#> [10] tools_4.0.0            grid_4.0.0             xfun_0.12             
#> [13] htmltools_0.4.0        yaml_2.2.1             digest_0.6.25         
#> [16] Matrix_1.2-18          GenomeInfoDbData_1.2.2 bitops_1.0-6          
#> [19] RCurl_1.98-1.1         evaluate_0.14          rmarkdown_2.1         
#> [22] stringi_1.4.6          compiler_4.0.0

Created on 2020-03-13 by the reprex package (v0.3.0)

LTLA commented 4 years ago

Rownames of the reduced dims are sync'd to the colnames of the SCE. If you want them back, set withDimnames=FALSE.

LiNk-NY commented 4 years ago

Thanks for the info!