stuart-lab / signac

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

TSSEnrichment Error (Multiome vignette) #834

Closed sjbegg closed 2 years ago

sjbegg commented 2 years ago

Hello,

I am running the vignette on the 10XMultiome dataset, and hitting an error that I'm unsure how to resolve.

 pbmc <- TSSEnrichment(pbmc)
Extracting TSS positions
Extracting fragments at TSSs
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s  

Computing TSS enrichment score
Error in ecdf(x = object$TSS.enrichment) : 
  'x' must have 1 or more non-missing values

Weirdly, this error didn't appear at the end of last week when I was running the code, and only when I started again this week. Any insight would be gratefully received as I'm totally stuck!

Thanks.

timoast commented 2 years ago

Please include the full code you're running and the output of sessionInfo()

sjbegg commented 2 years ago

Ah, I'm sorry!

Full code and output:

> library(Signac)
Warning message:
R graphics engine version 14 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed. 
> library(Seurat)
Attaching SeuratObject
> library(EnsDb.Hsapiens.v86)
Loading required package: ensembldb
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.max, which.min

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: S4Vectors

Attaching package: ‘S4Vectors’

The following objects are masked from ‘package:base’:

    expand.grid, I, unname

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
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: AnnotationFilter

Attaching package: 'ensembldb'

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

    filter

> library(BSgenome.Hsapiens.UCSC.hg38)
Loading required package: BSgenome
Loading required package: Biostrings
Loading required package: XVector

Attaching package: 'Biostrings'

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

    strsplit

Loading required package: rtracklayer
> 
> set.seed(1234)
> counts <- Read10X_h5("pbmc_granulocyte_sorted_10k_filtered_feature_bc_matrix.h5")
Genome matrix has multiple modalities, returning a list of matrices for this genome
Warning message:
In sparseMatrix(i = indices[] + 1, p = indptr[], x = as.numeric(x = counts[]),  :
  'giveCsparse' has been deprecated; setting 'repr = "T"' for you
> fragpath <- "pbmc_granulocyte_sorted_10k_atac_fragments.tsv.gz"
> annotation <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v86)
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
There were 24 warnings (use warnings() to see them)
> seqlevelsStyle(annotation) <- "UCSC"
 Error in .order_seqlevels(chrom_sizes[, "chrom"]) : 
  !anyNA(m32) is not TRUE 
> genome(annotation) <- "hg38"
> seqlevelsStyle(annotation) <- "UCSC"
> pbmc <- CreateSeuratObject(
+     counts = counts$`Gene Expression`,
+     assay = "RNA"
+ )
> pbmc[["ATAC"]] <- CreateChromatinAssay(
+     counts = counts$Peaks,
+     sep = c(":", "-"),
+     fragments = fragpath,
+     annotation = annotation
+ )
Computing hash
Checking for 11909 cell barcodes
> pbmc
An object of class Seurat 
144978 features across 11909 samples within 2 assays 
Active assay: RNA (36601 features, 0 variable features)
 1 other assay present: ATAC
> DefaultAssay(pbmc) <- "ATAC"
> 
> pbmc <- NucleosomeSignal(pbmc)
Found 11909 cell barcodes
Done Processing 59 million lines                  
> pbmc <- TSSEnrichment(pbmc)
Extracting TSS positions
Extracting fragments at TSSs
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s  

Computing TSS enrichment score
Error in ecdf(x = object$TSS.enrichment) : 
  'x' must have 1 or more non-missing values

Session info:

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Debian GNU/Linux rodete

Matrix products: default
BLAS/LAPACK: .../lib/libopenblasp-r0.3.18.so

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] stats4    parallel  stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] BSgenome.Hsapiens.UCSC.hg38_1.4.3 BSgenome_1.60.0                  
 [3] rtracklayer_1.52.1                Biostrings_2.60.2                
 [5] XVector_0.32.0                    EnsDb.Hsapiens.v86_2.99.0        
 [7] ensembldb_2.16.4                  AnnotationFilter_1.16.0          
 [9] GenomicFeatures_1.44.2            AnnotationDbi_1.54.1             
[11] Biobase_2.52.0                    GenomicRanges_1.44.0             
[13] GenomeInfoDb_1.28.4               IRanges_2.26.0                   
[15] S4Vectors_0.30.2                  BiocGenerics_0.38.0              
[17] SeuratObject_4.0.2                Seurat_4.0.5                     
[19] Signac_1.4.0                     

loaded via a namespace (and not attached):
  [1] utf8_1.2.2                  reticulate_1.22            
  [3] tidyselect_1.1.1            RSQLite_2.2.8              
  [5] htmlwidgets_1.5.4           grid_4.1.1                 
  [7] docopt_0.7.1                BiocParallel_1.26.2        
  [9] Rtsne_0.15                  munsell_0.5.0              
 [11] codetools_0.2-18            ica_1.0-2                  
 [13] future_1.22.1               miniUI_0.1.1.1             
 [15] colorspace_2.0-2            filelock_1.0.2             
 [17] knitr_1.36                  rstudioapi_0.13            
 [19] ROCR_1.0-11                 tensor_1.5                 
 [21] listenv_0.8.0               MatrixGenerics_1.4.3       
 [23] slam_0.1-48                 GenomeInfoDbData_1.2.6     
 [25] polyclip_1.10-0             bit64_4.0.5                
 [27] farver_2.1.0                parallelly_1.28.1          
 [29] vctrs_0.3.8                 generics_0.1.0             
 [31] xfun_0.26                   biovizBase_1.40.0          
 [33] BiocFileCache_2.0.0         lsa_0.73.2                 
 [35] ggseqlogo_0.1               R6_2.5.1                   
 [37] hdf5r_1.3.4                 bitops_1.0-7               
 [39] spatstat.utils_2.2-0        cachem_1.0.6               
 [41] DelayedArray_0.18.0         assertthat_0.2.1           
 [43] promises_1.2.0.1            BiocIO_1.2.0               
 [45] scales_1.1.1                nnet_7.3-16                
 [47] gtable_0.3.0                globals_0.14.0             
 [49] goftest_1.2-3               rlang_0.4.11               
 [51] RcppRoll_0.3.0              splines_4.1.1              
 [53] lazyeval_0.2.2              dichromat_2.0-0            
 [55] checkmate_2.0.0             spatstat.geom_2.3-0        
 [57] yaml_2.2.1                  reshape2_1.4.4             
 [59] abind_1.4-5                 backports_1.2.1            
 [61] httpuv_1.6.3                Hmisc_4.6-0                
 [63] tools_4.1.1                 ggplot2_3.3.5              
 [65] ellipsis_0.3.2              spatstat.core_2.3-0        
 [67] RColorBrewer_1.1-2          ggridges_0.5.3             
 [69] Rcpp_1.0.7                  plyr_1.8.6                 
 [71] base64enc_0.1-3             progress_1.2.2             
 [73] zlibbioc_1.38.0             purrr_0.3.4                
 [75] RCurl_1.98-1.5              prettyunits_1.1.1          
 [77] rpart_4.1-15                deldir_1.0-5               
 [79] pbapply_1.5-0               cowplot_1.1.1              
 [81] zoo_1.8-9                   SummarizedExperiment_1.22.0
 [83] ggrepel_0.9.1               cluster_2.1.2              
 [85] magrittr_2.0.1              data.table_1.14.2          
 [87] scattermore_0.7             lmtest_0.9-38              
 [89] RANN_2.6.1                  SnowballC_0.7.0            
 [91] ProtGenerics_1.24.0         fitdistrplus_1.1-6         
 [93] matrixStats_0.61.0          hms_1.1.1                  
 [95] patchwork_1.1.1             mime_0.12                  
 [97] xtable_1.8-4                XML_3.99-0.8               
 [99] jpeg_0.1-9                  sparsesvd_0.2              
[101] gridExtra_2.3               compiler_4.1.1             
[103] biomaRt_2.48.3              tibble_3.1.5               
[105] KernSmooth_2.23-20          crayon_1.4.1               
[107] htmltools_0.5.2             mgcv_1.8-38                
[109] later_1.3.0                 Formula_1.2-4              
[111] tidyr_1.1.4                 DBI_1.1.1                  
[113] tweenr_1.0.2                dbplyr_2.1.1               
[115] MASS_7.3-54                 rappdirs_0.3.3             
[117] Matrix_1.3-4                igraph_1.2.7               
[119] pkgconfig_2.0.3             GenomicAlignments_1.28.0   
[121] foreign_0.8-81              plotly_4.10.0              
[123] spatstat.sparse_2.0-0       xml2_1.3.2                 
[125] VariantAnnotation_1.38.0    stringr_1.4.0              
[127] digest_0.6.28               sctransform_0.3.2          
[129] RcppAnnoy_0.0.19            spatstat.data_2.1-0        
[131] leiden_0.3.9                fastmatch_1.1-3            
[133] htmlTable_2.3.0             uwot_0.1.10                
[135] restfulr_0.0.13             curl_4.3.2                 
[137] shiny_1.7.1                 Rsamtools_2.8.0            
[139] rjson_0.2.20                lifecycle_1.0.1            
[141] nlme_3.1-153                jsonlite_1.7.2             
[143] viridisLite_0.4.0           fansi_0.5.0                
[145] pillar_1.6.3                lattice_0.20-45            
[147] KEGGREST_1.32.0             fastmap_1.1.0              
[149] httr_1.4.2                  survival_3.2-13            
[151] glue_1.4.2                  qlcMatrix_0.9.7            
[153] png_0.1-7                   bit_4.0.4                  
[155] ggforce_0.3.3               stringi_1.7.5              
[157] blob_1.2.2                  latticeExtra_0.6-29        
[159] memoise_2.0.0               dplyr_1.0.7                
[161] irlba_2.3.3                 future.apply_1.8.1
timoast commented 2 years ago

This looks like the same issue as https://github.com/timoast/signac/issues/826