Seurat to SingleCellExperiment Converting error in MAC
1
0
Entering edit mode
@hamza_karakurt-17704
Last seen 5 months ago

Hello everyone,

I just started to work with MAC and using my own computer (Windows) as a tester.

I am trying to convert a Seurat object to SingleCellExperiment with Convert function of Seurat package. It works in Windows but does not work in MAC.

Also, is there a way in Scater package to read 10X files?

My codes are: 

rna.data <- Read10X(data.dir = "C:/Users/hamza/Documents/R/New_Plan/Sample_Data_10X/filtered_gene_bc_matrices/hg19")
rna <- CreateSeuratObject(raw.data = rna.data)

sce <- Convert(from = rna , to = "sce")

keep_feature <- rowSums(counts(sce) > 0) > 0
sce <- sce[keep_feature,]

I use the same codes in MAC but in the "keep_feature" step I have an error which says: 'x' must be an array of at least two dimensions

My session info for MAC:

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.2

Matrix products: default

BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib

LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/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  methods   base     

other attached packages:
 [1] scater_1.10.0               SingleCellExperiment_1.4.0  SummarizedExperiment_1.12.0 DelayedArray_0.8.0          BiocParallel_1.16.0         matrixStats_0.54.0         
 [7] Biobase_2.42.0              GenomicRanges_1.34.0        GenomeInfoDb_1.18.0         IRanges_2.16.0              S4Vectors_0.20.0            BiocGenerics_0.28.0        
[13] Seurat_2.3.4                Matrix_1.2-15               cowplot_0.9.3               ggplot2_3.1.0              

loaded via a namespace (and not attached):
  [1] ggbeeswarm_0.6.0         Rtsne_0.13               colorspace_1.3-2         class_7.3-14             modeltools_0.2-22        ggridges_0.5.1           mclust_5.4.1            
  [8] htmlTable_1.12           XVector_0.22.0           base64enc_0.1-3          rstudioapi_0.8           proxy_0.4-22             npsurv_0.4-0             flexmix_2.3-14          
 [15] bit64_0.9-7              mvtnorm_1.0-8            codetools_0.2-15         splines_3.5.1            R.methodsS3_1.7.1        lsei_1.2-0               robustbase_0.93-3       
 [22] knitr_1.20               Formula_1.2-3            jsonlite_1.5             ica_1.0-2                cluster_2.0.7-1          kernlab_0.9-27           png_0.1-7               
 [29] R.oo_1.22.0              HDF5Array_1.10.0         compiler_3.5.1           httr_1.3.1               backports_1.1.2          assertthat_0.2.0         lazyeval_0.2.1          
 [36] lars_1.2                 acepack_1.4.1            htmltools_0.3.6          tools_3.5.1              bindrcpp_0.2.2           igraph_1.2.2             GenomeInfoDbData_1.2.0  
 [43] gtable_0.2.0             glue_1.3.0               RANN_2.6                 reshape2_1.4.3           dplyr_0.7.7              Rcpp_1.0.0               trimcluster_0.1-2.1     
 [50] gdata_2.18.0             ape_5.2                  nlme_3.1-137             DelayedMatrixStats_1.4.0 iterators_1.0.10         fpc_2.1-11.1             gbRd_0.4-11             
 [57] lmtest_0.9-36            stringr_1.3.1            irlba_2.3.2              gtools_3.8.1             DEoptimR_1.0-8           zlibbioc_1.28.0          MASS_7.3-51.1           
 [64] zoo_1.8-4                scales_1.0.0             doSNOW_1.0.16            rhdf5_2.26.0             RColorBrewer_1.1-2       yaml_2.2.0               reticulate_1.10         
 [71] pbapply_1.3-4            gridExtra_2.3            rpart_4.1-13             segmented_0.5-3.0        latticeExtra_0.6-28      stringi_1.2.4            foreach_1.4.4           
 [78] checkmate_1.8.5          caTools_1.17.1.1         bibtex_0.4.2             Rdpack_0.10-1            SDMTools_1.1-221         rlang_0.3.0.1            pkgconfig_2.0.2         
 [85] dtw_1.20-1               prabclus_2.2-6           bitops_1.0-6             lattice_0.20-38          Rhdf5lib_1.4.0           ROCR_1.0-7               purrr_0.2.5             
 [92] bindr_0.1.1              htmlwidgets_1.3          bit_1.1-14               tidyselect_0.2.5         plyr_1.8.4               magrittr_1.5             R6_2.3.0                
 [99] snow_0.4-3               gplots_3.0.1             Hmisc_4.1-1              pillar_1.3.0             foreign_0.8-71           withr_2.1.2              fitdistrplus_1.0-11     
[106] mixtools_1.1.0           RCurl_1.95-4.11          survival_2.43-1          nnet_7.3-12              tibble_1.4.2             tsne_0.1-3               crayon_1.3.4            
[113] hdf5r_1.0.1              KernSmooth_2.23-15       viridis_0.5.1            grid_3.5.1               data.table_1.11.8        metap_1.0                digest_0.6.18           
[120] diptest_0.75-7           tidyr_0.8.2              R.utils_2.7.0            munsell_0.5.0            beeswarm_0.2.3           viridisLite_0.3.0        vipor_0.4.5             

Session info for Windows:

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=Turkish_Turkey.1254  LC_CTYPE=Turkish_Turkey.1254   
[3] LC_MONETARY=Turkish_Turkey.1254 LC_NUMERIC=C                   
[5] LC_TIME=Turkish_Turkey.1254    

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              
 [4] scater_1.10.0               ggplot2_3.1.0               SingleCellExperiment_1.4.0 
 [7] SummarizedExperiment_1.12.0 DelayedArray_0.8.0          BiocParallel_1.16.0        
[10] matrixStats_0.54.0          Biobase_2.42.0              GenomicRanges_1.34.0       
[13] GenomeInfoDb_1.18.0         IRanges_2.16.0              S4Vectors_0.20.0           
[16] BiocGenerics_0.28.0        

loaded via a namespace (and not attached):
  [1] snow_0.4-3               backports_1.1.2          Hmisc_4.1-1             
  [4] plyr_1.8.4               igraph_1.2.2             lazyeval_0.2.1          
  [7] splines_3.5.1            digest_0.6.18            foreach_1.4.4           
 [10] htmltools_0.3.6          viridis_0.5.1            lars_1.2                
 [13] gdata_2.18.0             magrittr_1.5             checkmate_1.8.5         
 [16] cluster_2.0.7-1          mixtools_1.1.0           ROCR_1.0-7              
 [19] R.utils_2.7.0            colorspace_1.3-2         dplyr_0.7.7             
 [22] crayon_1.3.4             RCurl_1.95-4.11          jsonlite_1.5            
 [25] bindr_0.1.1              survival_2.43-1          zoo_1.8-4               
 [28] iterators_1.0.10         ape_5.2                  glue_1.3.0              
 [31] gtable_0.2.0             zlibbioc_1.28.0          XVector_0.22.0          
 [34] kernlab_0.9-27           Rhdf5lib_1.4.0           prabclus_2.2-6          
 [37] DEoptimR_1.0-8           HDF5Array_1.10.0         scales_1.0.0            
 [40] mvtnorm_1.0-8            bibtex_0.4.2             Rcpp_0.12.19            
 [43] metap_1.0                dtw_1.20-1               viridisLite_0.3.0       
 [46] htmlTable_1.12           reticulate_1.10          foreign_0.8-71          
 [49] bit_1.1-14               proxy_0.4-22             mclust_5.4.1            
 [52] SDMTools_1.1-221         Formula_1.2-3            tsne_0.1-3              
 [55] htmlwidgets_1.3          httr_1.3.1               gplots_3.0.1            
 [58] RColorBrewer_1.1-2       fpc_2.1-11.1             acepack_1.4.1           
 [61] modeltools_0.2-22        ica_1.0-2                pkgconfig_2.0.2         
 [64] R.methodsS3_1.7.1        flexmix_2.3-14           nnet_7.3-12             
 [67] tidyselect_0.2.5         rlang_0.3.0.1            reshape2_1.4.3          
 [70] munsell_0.5.0            tools_3.5.1              ggridges_0.5.1          
 [73] stringr_1.3.1            yaml_2.2.0               npsurv_0.4-0            
 [76] knitr_1.20               bit64_0.9-7              fitdistrplus_1.0-11     
 [79] robustbase_0.93-3        caTools_1.17.1.1         purrr_0.2.5             
 [82] RANN_2.6                 bindrcpp_0.2.2           pbapply_1.3-4           
 [85] nlme_3.1-137             R.oo_1.22.0              hdf5r_1.0.1             
 [88] compiler_3.5.1           rstudioapi_0.8           beeswarm_0.2.3          
 [91] png_0.1-7                lsei_1.2-0               tibble_1.4.2            
 [94] stringi_1.2.4            lattice_0.20-35          trimcluster_0.1-2.1     
 [97] pillar_1.3.0             Rdpack_0.10-1            lmtest_0.9-36           
[100] data.table_1.11.8        bitops_1.0-6             irlba_2.3.2             
[103] gbRd_0.4-11              R6_2.3.0                 latticeExtra_0.6-28     
[106] KernSmooth_2.23-15       gridExtra_2.3            vipor_0.4.5             
[109] codetools_0.2-15         MASS_7.3-50              gtools_3.8.1            
[112] assertthat_0.2.0         rhdf5_2.26.0             withr_2.1.2             
[115] GenomeInfoDbData_1.2.0   diptest_0.75-7           doSNOW_1.0.16           
[118] grid_3.5.1               rpart_4.1-13             tidyr_0.8.2             
[121] class_7.3-14             DelayedMatrixStats_1.4.0 segmented_0.5-3.0       
[124] Rtsne_0.13               base64enc_0.1-3          ggbeeswarm_0.6.0        

 

 

Thank you.

singlecellexperiment single-cell rnaseq • 818 views
ADD COMMENT
3
Entering edit mode
@steve-lianoglou-2771
Last seen 1 day ago
Denali

I'm pretty sure you are getting the "'x' must be an array of at least two dimensions" error in this code block:

keep_feature <- rowSums(counts(sce) > 0) > 0

Because the counts function is returning a sparse matrix, and you are using the base::rowSums function, which doesn't know how to handle it. The Matrix::rowSums function should do the trick, ie.

library(Matrix)
keep_feature <- Matrix::rowSums(counts(sce) > 0) > 0

Also, you will find a read10xCounts function in the DropletUtils package that will load up a 10x dataset into a SingleCellExperiment.

ADD COMMENT
0
Entering edit mode

Thank you so much. It worked.

ADD REPLY

Login before adding your answer.

Traffic: 220 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6