satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.25k stars 904 forks source link

Error with ReadH5AD in .subset2 #2060

Closed mcfefa closed 5 years ago

mcfefa commented 5 years ago

I downloaded a publicly available 10X scRNAseq, which had the data saved as a .h5ad file. Following along with the Conversion Vignette, I installed the scater & loomR packages, however, when I used the ReadH5AD() function, I got an error that said Error in .subset2(x, i, exact = exact) : subscript out of bounds. Below is how I implemented ReadH5AD with the output:

R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> library(Seurat)
Registered S3 method overwritten by 'R.oo':
  method        from       
  throw.default R.methodsS3
> library(scater)
Loading required package: SingleCellExperiment
Loading required package: SummarizedExperiment
Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: DelayedArray
Loading required package: matrixStats

Attaching package: 'matrixStats'

The following objects are masked from 'package:Biobase':

    anyMissing, rowMedians

Loading required package: BiocParallel

Attaching package: 'DelayedArray'

The following objects are masked from 'package:matrixStats':

    colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges

The following objects are masked from 'package:base':

    aperm, apply, rowsum

Loading required package: ggplot2

Attaching package: 'scater'

The following object is masked from 'package:S4Vectors':

    rename

The following object is masked from 'package:stats':

    filter

> library(loomR)
Loading required package: R6
Loading required package: hdf5r

Attaching package: 'hdf5r'

The following object is masked from 'package:SummarizedExperiment':

    values

The following object is masked from 'package:GenomicRanges':

    values

The following object is masked from 'package:IRanges':

    values

The following object is masked from 'package:S4Vectors':

    values

Attaching package: 'loomR'

The following object is masked from 'package:Biobase':

    combine

The following object is masked from 'package:BiocGenerics':

    combine

> setwd("/share/lab_padron/Meghan/scRNAseq/Setty-normalCD34/")
> SettyPt1 <- ReadH5AD(file = "./human_cd34_bm_rep1.h5ad", assay = "RNA", verbose = TRUE) 
Pulling expression matrices and metadata
Data is scaled
Merging feature-level metadata dataframes
Creating assay object
Storing X as scale.data and raw as data
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Error in .subset2(x, i, exact = exact) : subscript out of bounds

The sessionInfo() for R is below:

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.10 (Final)

Matrix products: default
BLAS:   /share/apps/R-3.6.0/lib64/R/lib/libRblas.so
LAPACK: /share/apps/R-3.6.0/lib64/R/lib/libRlapack.so

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
 [1] LC_CTYPE=en_US.iso885915       LC_NUMERIC=C                  
 [3] LC_TIME=en_US.iso885915        LC_COLLATE=en_US.iso885915    
 [5] LC_MONETARY=en_US.iso885915    LC_MESSAGES=en_US.iso885915   
 [7] LC_PAPER=en_US.iso885915       LC_NAME=C                     
 [9] LC_ADDRESS=C                   LC_TELEPHONE=C                
[11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C           

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

other attached packages:
 [1] loomR_0.2.1.9000            hdf5r_1.2.0                
 [3] R6_2.4.0                    scater_1.12.2              
 [5] ggplot2_3.2.0               SingleCellExperiment_1.6.0 
 [7] SummarizedExperiment_1.14.1 DelayedArray_0.10.0        
 [9] BiocParallel_1.18.1         matrixStats_0.54.0         
[11] Biobase_2.44.0              GenomicRanges_1.36.0       
[13] GenomeInfoDb_1.20.0         IRanges_2.18.1             
[15] S4Vectors_0.22.0            BiocGenerics_0.30.0        
[17] Seurat_3.0.2               

loaded via a namespace (and not attached):
 [1] Rtsne_0.15               ggbeeswarm_0.6.0         colorspace_1.4-1        
 [4] ggridges_0.5.1           XVector_0.24.0           BiocNeighbors_1.2.0     
 [7] listenv_0.7.0            npsurv_0.4-0             ggrepel_0.8.1           
[10] bit64_0.9-7              codetools_0.2-16         splines_3.6.0           
[13] R.methodsS3_1.7.1        lsei_1.2-0               jsonlite_1.6            
[16] ica_1.0-2                cluster_2.1.0            png_0.1-7               
[19] R.oo_1.22.0              sctransform_0.2.0        compiler_3.6.0          
[22] httr_1.4.0               assertthat_0.2.1         Matrix_1.2-17           
[25] lazyeval_0.2.2           BiocSingular_1.0.0       htmltools_0.3.6         
[28] tools_3.6.0              rsvd_1.0.2               igraph_1.2.4.1          
[31] gtable_0.3.0             glue_1.3.1               GenomeInfoDbData_1.2.1  
[34] RANN_2.6.1               reshape2_1.4.3           dplyr_0.8.3             
[37] Rcpp_1.0.2               gdata_2.18.0             ape_5.3                 
[40] nlme_3.1-141             DelayedMatrixStats_1.6.0 gbRd_0.4-11             
[43] lmtest_0.9-37            stringr_1.4.0            globals_0.12.4          
[46] irlba_2.3.3              gtools_3.8.1             future_1.14.0           
[49] MASS_7.3-51.4            zlibbioc_1.30.0          zoo_1.8-6               
[52] scales_1.0.0             RColorBrewer_1.1-2       reticulate_1.13         
[55] pbapply_1.4-1            gridExtra_2.3            stringi_1.4.3           
[58] caTools_1.17.1.2         bibtex_0.4.2             Rdpack_0.11-0           
[61] SDMTools_1.1-221.1       rlang_0.4.0              pkgconfig_2.0.2         
[64] bitops_1.0-6             lattice_0.20-38          ROCR_1.0-7              
[67] purrr_0.3.2              htmlwidgets_1.3          cowplot_1.0.0           
[70] bit_1.1-14               tidyselect_0.2.5         plyr_1.8.4              
[73] magrittr_1.5             gplots_3.0.1.1           pillar_1.4.2            
[76] withr_2.1.2              fitdistrplus_1.0-14      survival_2.44-1.1       
[79] RCurl_1.95-4.12          tibble_2.1.3             future.apply_1.3.0      
[82] tsne_0.1-3               crayon_1.3.4             KernSmooth_2.23-15      
[85] plotly_4.9.0             viridis_0.5.1            grid_3.6.0              
[88] data.table_1.12.2        metap_1.1                digest_0.6.20           
[91] tidyr_0.8.3              R.utils_2.9.0            munsell_0.5.0           
[94] beeswarm_0.2.3           viridisLite_0.3.0        vipor_0.4.5    

Please advise on what I should do to correct this error or if this is an issue with the dataset.

mcfefa commented 5 years ago

This issue persists when upgrading to Seurat v3.1.0.

const-ae commented 5 years ago

I get the same error with the another dataset: svensson_chromium_control.h5ad from https://figshare.com/projects/Zero_inflation_in_negative_control_data/61292

mojaveazure commented 5 years ago

This should be fixed in the development version of Seurat. To install the development version of Seurat, please see the instructions here.