Seurat: Error with CreateSeuratObject

Created on 25 Apr 2018  路  12Comments  路  Source: satijalab/seurat

I am trying to use the pipeline to integrate my samples. However after I loaded the data, and try to create a Seurat object out of it, an error occurred:

Error in [email protected][, cells.use] : 
  invalid or not-yet-implemented 'Matrix' subsetting

Does anyone know what's going on?

P.S. I am using Seurat 2.3.0, Matrix 1.2.1 if it helps.

Most helpful comment

Hi, had the same problem. Noticed my dgCMatrix didn't have dimnames assigned, while the matrix in the tutorial does.
This works (or assign more meaningful dimnames):

colnames(m) = as.character(c(1:ncol(m)))
rownames(m) = as.character(c(1:nrow(m)))
seurat_m = CreateSeuratObject(m)

All 12 comments

Hi @h1hui,

Would you be able to send us your dataset and the exact CreateSeuratObject command used?

I am also receiving the same error when trying to recapitulate one of your tutorials...

pbmc.data <- Read10X(data.dir = "~/data/pbmc8k/filtered_gene_bc_matrices/GRCh38/")
pbmc8k <- CreateSeuratObject(raw.data = pbmc.data, project = "PBMC8K")
Error in [email protected][, cells.use] : 
  invalid or not-yet-implemented 'Matrix' subsetting

image

@llmcgrath I am unable to replicate the bug. I suggest updating your version of Matrix to the latest version (1.2-14).

That worked, thanks @mojaveazure

Hi there,

I'm using Matrix 1.2-14, but when I run
sce_seurat <- Convert(from = sce_10x_filtered, to = "seurat")

I get the

Error in [email protected][, cells.use] : invalid or not-yet-implemented 'Matrix' subsetting error. Any idea of what might be causing this?

Thanks!

I also have the same issue. I'm on Seurat_2.3.4 & Matrix_1.2-14

> > seu <- CreateSeuratObject(raw.data = counts(sce))
> Error in [email protected][, cells.use] : 
>   invalid or not-yet-implemented 'Matrix' subsetting
> 

My session dump 

> sessionInfo()
> R version 3.5.1 (2018-07-02)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows >= 8 x64 (build 9200)
> 
> Matrix products: default
> 
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
> [5] LC_TIME=English_United States.1252    
> 
> attached base packages:
> [1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     
> 
> other attached packages:
>  [1] Seurat_2.3.4                Matrix_1.2-14               cowplot_0.9.3               scater_1.8.4                ggplot2_3.0.0              
>  [6] scran_1.8.4                 SingleCellExperiment_1.2.0  SummarizedExperiment_1.10.1 DelayedArray_0.6.5          BiocParallel_1.14.2        
> [11] matrixStats_0.54.0          Biobase_2.40.0              GenomicRanges_1.32.6        GenomeInfoDb_1.16.0         IRanges_2.14.10            
> [16] S4Vectors_0.18.3            BiocGenerics_0.26.0        
> 
> loaded via a namespace (and not attached):
>   [1] snow_0.4-2               backports_1.1.2          Hmisc_4.1-1              plyr_1.8.4               igraph_1.2.2             lazyeval_0.2.1          
>   [7] shinydashboard_0.7.0     splines_3.5.1            digest_0.6.15            foreach_1.4.4            htmltools_0.3.6          viridis_0.5.1           
>  [13] lars_1.2                 gdata_2.18.0             magrittr_1.5             checkmate_1.8.5          cluster_2.0.7-1          mixtools_1.1.0          
>  [19] ROCR_1.0-7               limma_3.36.2             R.utils_2.6.0            colorspace_1.3-2         dplyr_0.7.6              jsonlite_1.5            
>  [25] crayon_1.3.4             RCurl_1.95-4.11          tximport_1.8.0           bindr_0.1.1              zoo_1.8-3                ape_5.1                 
>  [31] survival_2.42-3          iterators_1.0.10         glue_1.3.0               gtable_0.2.0             zlibbioc_1.26.0          XVector_0.20.0          
>  [37] kernlab_0.9-27           Rhdf5lib_1.2.1           prabclus_2.2-6           DEoptimR_1.0-8           scales_1.0.0             mvtnorm_1.0-8           
>  [43] edgeR_3.22.3             bibtex_0.4.2             Rcpp_0.12.18             dtw_1.20-1               metap_1.0                viridisLite_0.3.0       
>  [49] xtable_1.8-2             htmlTable_1.12           reticulate_1.10          bit_1.1-14               proxy_0.4-22             foreign_0.8-70          
>  [55] mclust_5.4.1             SDMTools_1.1-221         Formula_1.2-3            tsne_0.1-3               DT_0.4                   httr_1.3.1              
>  [61] htmlwidgets_1.2          FNN_1.1.2.1              gplots_3.0.1             RColorBrewer_1.1-2       fpc_2.1-11.1             acepack_1.4.1           
>  [67] modeltools_0.2-22        ica_1.0-2                pkgconfig_2.0.2          R.methodsS3_1.7.1        flexmix_2.3-14           nnet_7.3-12             
>  [73] locfit_1.5-9.1           dynamicTreeCut_1.63-1    tidyselect_0.2.4         rlang_0.2.1              reshape2_1.4.3           later_0.7.3             
>  [79] munsell_0.5.0            tools_3.5.1              ggridges_0.5.0           stringr_1.3.1            bit64_0.9-7              knitr_1.20              
>  [85] fitdistrplus_1.0-9       robustbase_0.93-2        caTools_1.17.1.1         purrr_0.2.5              RANN_2.6                 bindrcpp_0.2.2          
>  [91] nlme_3.1-137             pbapply_1.3-4            mime_0.5                 R.oo_1.22.0              hdf5r_1.0.0              compiler_3.5.1          
>  [97] rstudioapi_0.7           png_0.1-7                beeswarm_0.2.3           tibble_1.4.2             statmod_1.4.30           stringi_1.1.7           
> [103] lattice_0.20-35          trimcluster_0.1-2.1      pillar_1.3.0             lmtest_0.9-36            Rdpack_0.9-0             irlba_2.3.2             
> [109] data.table_1.11.4        bitops_1.0-6             gbRd_0.4-11              httpuv_1.4.5             R6_2.2.2                 latticeExtra_0.6-28     
> [115] promises_1.0.1           KernSmooth_2.23-15       gridExtra_2.3            vipor_0.4.5              codetools_0.2-15         MASS_7.3-50             
> [121] gtools_3.8.1             assertthat_0.2.0         rhdf5_2.24.0             rjson_0.2.20             withr_2.1.2              GenomeInfoDbData_1.1.0  
> [127] diptest_0.75-7           doSNOW_1.0.16            grid_3.5.1               rpart_4.1-13             tidyr_0.8.1              class_7.3-14            
> [133] DelayedMatrixStats_1.2.0 segmented_0.5-3.0        Rtsne_0.13               shiny_1.1.0              base64enc_0.1-3          ggbeeswarm_0.6.0        
> > 

Had the exact same issue. Worked around by casting the assays in the SingleCellExperiment object as dense matrix and then applying the conversion. Maybe the problem is due to some methods that are not available for the dgCMatrix?

Hi, had the same problem. Noticed my dgCMatrix didn't have dimnames assigned, while the matrix in the tutorial does.
This works (or assign more meaningful dimnames):

colnames(m) = as.character(c(1:ncol(m)))
rownames(m) = as.character(c(1:nrow(m)))
seurat_m = CreateSeuratObject(m)

@abreschi

That works except for a small change -

colnames(counts) = seq(1, ncol(counts))
rownames(counts) = seq(1, nrow(counts))
seurat_m = CreateSeuratObject(counts)

same issue when converting SingleCellExperiment to seurat object using Convert function.

same issue when using ScaleData function, even when I replicate the sample in Official Lab Sample

In my case, this happened because - when changing the rownames of obj@data (to HGNC symbols rather than ENSEMBL IDs) - I inadvertently changed the class of the rownames from "character" to array. Perhaps check:
class(rownames(obj@data))=="character"
is TRUE

Was this page helpful?
0 / 5 - 0 ratings