stuart-lab / signac

R toolkit for the analysis of single-cell chromatin data
https://stuartlab.org/signac/
Other
325 stars 87 forks source link

Unable to GetGRangesFromEnsDb #938

Closed FraMont1 closed 2 years ago

FraMont1 commented 2 years ago

Hi,

Thank you for creating such a useful tool.

I am trying to reproduce the tutorial: Analyzing PBMC scATAC-seq using the following code (the same of the tutorial)

library(Signac)
library(Seurat)
library(GenomeInfoDb)
library(EnsDb.Hsapiens.v75)
library(ggplot2)
library(patchwork)
set.seed(1234)

counts <- Read10X_h5(filename = "Desktop/SC_ATAseq/atac_v1_pbmc_10k_filtered_peak_bc_matrix.h5")

metadata <- read.csv(
  file = "Desktop/SC_ATAseq/atac_v1_pbmc_10k_singlecell.csv",
  header = TRUE,
  row.names = 1
)

chrom_assay <- CreateChromatinAssay(
  counts = counts,
  sep = c(":", "-"),
  genome = 'hg19',
  fragments = 'Desktop/SC_ATAseq/atac_v1_pbmc_10k_fragments.tsv.gz',
  min.cells = 10,
  min.features = 200
)

pbmc <- CreateSeuratObject(
  counts = chrom_assay,
  assay = "peaks",
  meta.data = metadata
)

pbmc
##An object of class Seurat 
##87561 features across 8728 samples within 1 assay 
##Active assay: peaks (87561 features, 0 variable features)

pbmc[['peaks']]
##ChromatinAssay data with 87561 features for 8728 cells
##Variable features: 0 
##Genome: hg19 
##Annotation present: FALSE 
##Motifs present: FALSE 
##Fragment files: 1 

granges(pbmc)
##GRanges object with 87561 ranges and 0 metadata columns:
##         seqnames            ranges strand
##             <Rle>         <IRanges>  <Rle>
##      [1]     chr1     565107-565550      *
##      [2]     chr1     569174-569639      *
##     [3]     chr1     713460-714823      *
##      [4]     chr1     752422-753038      *
##      [5]     chr1     762106-763359      *
##      ...      ...               ...    ...
##  [87557]     chrY 58993392-58993760      *
##  [87558]     chrY 58994571-58994823      *
##  [87559]     chrY 58996352-58997331      *
##  [87560]     chrY 59001782-59002175      *
##  [87561]     chrY 59017143-59017246      *
##  -------
##  seqinfo: 24 sequences from an unspecified genome; no seqlengths

# extract gene annotations from EnsDb
annotations <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v75)`

but I obtain this error

annotations <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v75)
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'splitAsList': error in evaluating the argument 'x' in selecting a method for function 'end': error in evaluating the argument 'args' in selecting a method for function 'do.call': argument of length 0

I have tried to see if someone else had this issue, I have tried to install different version of Seurat and Signac but I did not find how to figure out.

Any help would be greatly appreciated. Best wishes Francesco

This is my session info:

R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] it_IT.UTF-8/it_IT.UTF-8/it_IT.UTF-8/C/it_IT.UTF-8/it_IT.UTF-8

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

other attached packages:
 [1] patchwork_1.1.1           ggplot2_3.3.5             EnsDb.Hsapiens.v75_2.99.0
 [4] ensembldb_2.14.1          AnnotationFilter_1.14.0   GenomicFeatures_1.42.3   
 [7] AnnotationDbi_1.52.0      Biobase_2.50.0            GenomicRanges_1.42.0     
[10] GenomeInfoDb_1.31.1       IRanges_2.24.1            S4Vectors_0.28.1         
[13] BiocGenerics_0.40.0       SeuratObject_4.0.4        Seurat_4.0.4             
[16] Signac_1.5.0.9000        

loaded via a namespace (and not attached):
  [1] utf8_1.2.2                  reticulate_1.23             tidyselect_1.1.1           
  [4] RSQLite_2.2.9               htmlwidgets_1.5.4           grid_4.0.3                 
  [7] docopt_0.7.1                BiocParallel_1.24.1         Rtsne_0.15                 
 [10] devtools_2.4.3              munsell_0.5.0               codetools_0.2-18           
 [13] ica_1.0-2                   future_1.23.0               miniUI_0.1.1.1             
 [16] withr_2.4.3                 colorspace_2.0-2            knitr_1.37                 
 [19] rstudioapi_0.13             ROCR_1.0-11                 tensor_1.5                 
 [22] listenv_0.8.0               MatrixGenerics_1.2.1        slam_0.1-49                
 [25] GenomeInfoDbData_1.2.4      polyclip_1.10-0             bit64_4.0.5                
 [28] farver_2.1.0                rprojroot_2.0.2             parallelly_1.30.0          
 [31] vctrs_0.3.8.9001            generics_0.1.1              xfun_0.29                  
 [34] biovizBase_1.38.0           BiocFileCache_1.14.0        lsa_0.73.2                 
 [37] ggseqlogo_0.1               R6_2.5.1                    hdf5r_1.3.5                
 [40] DelayedArray_0.16.3         bitops_1.0-7                spatstat.utils_2.3-0       
 [43] cachem_1.0.6                assertthat_0.2.1            promises_1.2.0.1           
 [46] scales_1.1.1                nnet_7.3-17                 gtable_0.3.0               
 [49] globals_0.14.0              processx_3.5.2              goftest_1.2-3              
 [52] rlang_0.99.0.9003           RcppRoll_0.3.0              splines_4.0.3              
 [55] rtracklayer_1.50.0          lazyeval_0.2.2              dichromat_2.0-0            
 [58] checkmate_2.0.0             spatstat.geom_2.3-1         reshape2_1.4.4             
 [61] abind_1.4-5                 backports_1.4.1             httpuv_1.6.5               
 [64] Hmisc_4.6-0                 tools_4.0.3                 usethis_2.1.5              
 [67] ellipsis_0.3.2              spatstat.core_2.3-2         RColorBrewer_1.1-2         
 [70] sessioninfo_1.2.2           ggridges_0.5.3              Rcpp_1.0.7                 
 [73] plyr_1.8.6                  base64enc_0.1-3             progress_1.2.2             
 [76] zlibbioc_1.36.0             purrr_0.3.4                 RCurl_1.98-1.5             
 [79] ps_1.6.0                    prettyunits_1.1.1           rpart_4.1-15               
 [82] openssl_1.4.6               deldir_1.0-6                pbapply_1.5-0              
 [85] cowplot_1.1.1               zoo_1.8-9                   SummarizedExperiment_1.20.0
 [88] ggrepel_0.9.1               cluster_2.1.2               fs_1.5.2                   
 [91] tinytex_0.36                magrittr_2.0.1              data.table_1.14.2          
 [94] scattermore_0.7             lmtest_0.9-39               RANN_2.6.1                 
 [97] SnowballC_0.7.0             ProtGenerics_1.22.0         fitdistrplus_1.1-6         
[100] matrixStats_0.61.0          pkgload_1.2.4               hms_1.1.1                  
[103] mime_0.12                   xtable_1.8-4                XML_3.99-0.8               
[106] jpeg_0.1-9                  sparsesvd_0.2               gridExtra_2.3              
[109] testthat_3.1.1              compiler_4.0.3              biomaRt_2.46.3             
[112] tibble_3.1.6                KernSmooth_2.23-20          crayon_1.4.2               
[115] htmltools_0.5.2             mgcv_1.8-38                 later_1.3.0                
[118] Formula_1.2-4               tidyr_1.1.4                 DBI_1.1.2                  
[121] tweenr_1.0.2                dbplyr_2.1.1                rappdirs_0.3.3             
[124] MASS_7.3-55                 Matrix_1.4-0                cli_3.1.0                  
[127] parallel_4.0.3              igraph_1.2.10               pkgconfig_2.0.3            
[130] GenomicAlignments_1.26.0    foreign_0.8-82              plotly_4.10.0              
[133] spatstat.sparse_2.1-0       xml2_1.3.3                  XVector_0.30.0             
[136] VariantAnnotation_1.36.0    stringr_1.4.0               callr_3.7.0                
[139] digest_0.6.29               sctransform_0.3.2           RcppAnnoy_0.0.19           
[142] spatstat.data_2.1-2         Biostrings_2.58.0           leiden_0.3.9               
[145] fastmatch_1.1-3             htmlTable_2.4.0             uwot_0.1.11                
[148] curl_4.3.2                  shiny_1.7.1                 Rsamtools_2.6.0            
[151] lifecycle_1.0.1             nlme_3.1-153                jsonlite_1.7.3             
[154] BSgenome_1.58.0             desc_1.4.0                  viridisLite_0.4.0          
[157] askpass_1.1                 fansi_1.0.2                 pillar_1.6.4               
[160] lattice_0.20-45             fastmap_1.1.0               httr_1.4.2                 
[163] pkgbuild_1.3.1              survival_3.2-13             glue_1.6.0                 
[166] remotes_2.4.2               qlcMatrix_0.9.7             png_0.1-7                  
[169] bit_4.0.4                   ggforce_0.3.3               stringi_1.7.6              
[172] blob_1.2.2                  latticeExtra_0.6-29         memoise_2.0.1              
[175] dplyr_1.0.7                 irlba_2.3.5                 future.apply_1.8.1  
timoast commented 2 years ago

I wasn't able to reproduce this issue. Can you try running this code and see if you have any errors:

library(GenomeInfoDb)

whole.genome <- as(object = seqinfo(x = EnsDb.Hsapiens.v75), Class = "GRanges")
whole.genome <- keepStandardChromosomes(whole.genome, pruning.mode = "coarse")
annot <- biovizBase::crunch(obj = EnsDb.Hsapiens.v75, which = whole.genome[1], 
                   columns = c("tx_id", "gene_name", "gene_id", 
                               "gene_biotype"))

If so, then the issue is likely with some Bioconductor dependencies rather than Signac itself.

FraMont1 commented 2 years ago

Thank you for your answer.

I ran the code and I obtained the same error

Fetching data...OK Parsing exons...OK Defining introns...OK Defining UTRs...Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'splitAsList': error in evaluating the argument 'x' in selecting a method for function 'end': error in evaluating the argument 'args' in selecting a method for function 'do.call': is this a possible issue due to Bioconductor dependencies?

timoast commented 2 years ago

Yes, you can get support for this on the bioconductor site: https://support.bioconductor.org/