zhanghao-njmu / SCP

An end-to-end Single-Cell Pipeline designed to facilitate comprehensive analysis and exploration of single-cell data.
https://zhanghao-njmu.github.io/SCP/
GNU General Public License v3.0
351 stars 79 forks source link

Velocity genes #182

Closed giorgiatosoni closed 10 months ago

giorgiatosoni commented 10 months ago

Hi,

Thank you so much for this amazing tool! I'm running the RunSCVELO function and I'm interested in checking the velocity genes. I set the argument calculate_velocity_genes to T but when I do that I get an error (see below). RunSCVELO with calculate_velocity_genes=F runs without any problems

Thank you in advance,

Giorgia

Assay 'Ms' is in the srt object but not converted. Assay 'Mu' is in the srt object but not converted. Assay 'stochastic' is in the srt object but not converted. Assay 'variance_stochastic' is in the srt object but not converted. Assay 'velocity' is in the srt object but not converted. Assay 'variance_velocity' is in the srt object but not converted. 'misc' slot is not converted. 'tools' slot is not converted. Renamed 'harmony.umap' to convention 'X_harmony.umap' (adata.obsm). Filtered out 33025 genes that are detected 30 counts (shared). Normalized count data: X, spliced, unspliced. WARNING: Did not modify X as it looks preprocessed already. computing neighbors finished (0:00:00) --> added 'distances' and 'connectivities', weighted adjacency matrices (adata.obsp) computing moments based on connectivities finished (0:00:01) --> added 'Ms' and 'Mu', moments of un/spliced abundances (adata.layers) computing velocities finished (0:00:01) --> added 'stochastic', velocity vectors for each individual cell (adata.layers) computing velocity graph (using 1/8 cores) finished (0:00:01) --> added 'stochastic_graph', sparse matrix with cosine correlations (adata.uns) computing velocity embedding finished (0:00:00) --> added 'stochastic_harmony.umap', embedded velocity vectors (adata.obsm) --> added 'stochastic_length' (adata.obs) --> added 'stochastic_confidence' (adata.obs) /Users/admin/Library/r-miniconda/envs/SCP_env/lib/python3.8/site-packages/scvelo/plotting/utils.py:869: MatplotlibDeprecationWarning: The draw_all function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use fig.draw_without_rendering() instead. cb.draw_all() computing terminal states WARNING: Uncertain or fuzzy root cell identification. Please verify. identified 4 regions of root cells and 2 regions of end points . finished (0:00:00) --> added 'root_cells', root cells of Markov diffusion process (adata.obs) 'end_points', end points of Markov diffusion process (adata.obs) /Users/admin/Library/r-miniconda/envs/SCP_env/lib/python3.8/site-packages/scvelo/plotting/utils.py:869: MatplotlibDeprecationWarning: The draw_all function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use fig.draw_without_rendering() instead. cb.draw_all() running PAGA using priors: ['stochastic_root_cells', 'stochastic_end_points'] finished (0:00:00) --> added 'paga/connectivities', connectivities adjacency (adata.uns) 'paga/connectivities_tree', connectivities subtree (adata.uns) 'paga/transitions_confidence', velocity transitions (adata.uns) WARNING: Invalid color key. Using grey instead. ranking velocity genes /Users/admin/Library/r-miniconda/envs/SCP_env/lib/python3.8/site-packages/scvelo/tools/utils.py:501: DeprecationWarning: Please use rankdata from the scipy.stats namespace, the scipy.stats.stats namespace is deprecated. from scipy.stats.stats import rankdata finished (0:00:03) --> added 'rank_velocity_genes', sorted scores by group ids (adata.uns) 'spearmans_score', spearmans correlation scores (adata.var) /Users/admin/Library/r-miniconda/envs/SCP_env/lib/python3.8/site-packages/scvelo/plotting/utils.py:869: MatplotlibDeprecationWarning: The draw_all function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use fig.draw_without_rendering() instead. cb.draw_all() Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from variancestochastic to variancestochastic_Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from variancevelocity to variancevelocityWarning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from umap.unintegrated to umapunintegratedWarning: All keys should be one or more alphanumeric characters followed by an underscore '', setting key to umapunintegratedWarning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from harmony.umap to harmonyumapWarning: All keys should be one or more alphanumeric characters followed by an underscore '', setting key to harmonyumapWarning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from stochasticharmony.umap to stochasticharmonyumapWarning: All keys should be one or more alphanumeric characters followed by an underscore '', setting key to stochasticharmonyumapWarning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from harmony.umap to harmonyumapWarning: All keys should be one or more alphanumeric characters followed by an underscore '', setting key to harmonyumap_Error: Conversion from numpy array type 20 is not supported

sessionInfo() R version 4.3.1 (2023-06-16) Platform: x86_64-apple-darwin20 (64-bit) Running under: macOS Big Sur 11.3.1

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

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

time zone: Europe/Amsterdam tzcode source: internal

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

other attached packages: [1] readxl_1.4.3 SeuratObject_4.1.3 Seurat_4.3.0.1 ComplexHeatmap_2.16.0 ggrepel_0.9.3 ggplot2_3.4.3
[7] DelayedMatrixStats_1.22.6 DelayedArray_0.26.7 S4Arrays_1.0.6 abind_1.4-5 IRanges_2.34.1 S4Vectors_0.38.2
[13] BiocGenerics_0.46.0 Matrix_1.6-0 MatrixGenerics_1.12.3 matrixStats_1.0.0 BiocManager_1.30.22 SCP_0.5.1

loaded via a namespace (and not attached): [1] R.methodsS3_1.8.2 progress_1.2.2 urlchecker_1.0.1 goftest_1.2-3 Biostrings_2.68.1 vctrs_0.6.3
[7] spatstat.random_3.1-6 digest_0.6.33 png_0.1-8 shape_1.4.6 slingshot_2.8.0 deldir_1.0-9
[13] parallelly_1.36.0 renv_1.0.2 MASS_7.3-60 Signac_1.10.0 reshape2_1.4.4 httpuv_1.6.11
[19] foreach_1.5.2 qvalue_2.32.0 withr_2.5.0 xfun_0.40 ggfun_0.1.3 ellipsis_0.3.2
[25] survival_3.5-5 memoise_2.0.1 proxyC_0.3.3 ggbeeswarm_0.7.2 clusterProfiler_4.8.3 gson_0.1.0
[31] princurve_2.1.6 profvis_0.3.8 tidytree_0.4.5 zoo_1.8-12 GlobalOptions_0.1.2 simplifyEnrichment_1.10.0
[37] pbapply_1.7-2 R.oo_1.25.0 prettyunits_1.2.0 KEGGREST_1.40.0 promises_1.2.1 httr_1.4.7
[43] downloader_0.4 restfulr_0.0.15 globals_0.16.2 fitdistrplus_1.1-11 ps_1.7.5 rstudioapi_0.15.0
[49] miniUI_0.1.1.1 generics_0.1.3 DOSE_3.26.1 processx_3.8.2 curl_5.0.2 zlibbioc_1.46.0
[55] ScaledMatrix_1.8.1 ggraph_2.1.0 polyclip_1.10-4 GenomeInfoDbData_1.2.10 xtable_1.8-4 stringr_1.5.0
[61] doParallel_1.0.17 evaluate_0.21 BiocFileCache_2.8.0 hms_1.1.3 GenomicRanges_1.52.0 irlba_2.3.5.1
[67] colorspace_2.1-0 filelock_1.0.2 NLP_0.2-1 ROCR_1.0-11 reticulate_1.32.0 spatstat.data_3.0-1
[73] magrittr_2.0.3 lmtest_0.9-40 later_1.3.1 viridis_0.6.4 ggtree_3.8.2 lattice_0.21-8
[79] spatstat.geom_3.2-5 future.apply_1.11.0 scuttle_1.10.3 scattermore_1.2 XML_3.99-0.14 shadowtext_0.1.2
[85] cowplot_1.1.1 RcppAnnoy_0.0.21 pillar_1.9.0 nlme_3.1-162 iterators_1.0.14 beachmat_2.16.0
[91] compiler_4.3.1 stringi_1.7.12 tensor_1.5 SummarizedExperiment_1.30.2 devtools_2.4.5 GenomicAlignments_1.36.0
[97] plyr_1.8.8 scater_1.28.0 BiocIO_1.10.0 crayon_1.5.2 gridGraphics_0.5-1 locfit_1.5-9.8
[103] sp_2.0-0 graphlayouts_1.0.1 org.Hs.eg.db_3.17.0 bit_4.0.5 dplyr_1.1.3 fastmatch_1.1-4
[109] codetools_0.2-19 BiocSingular_1.16.0 crosstalk_1.2.0 slam_0.1-50 GetoptLong_1.0.5 plotly_4.10.2
[115] tm_0.7-11 mime_0.12 splines_4.3.1 circlize_0.4.15 Rcpp_1.0.11 dbplyr_2.3.3
[121] sparseMatrixStats_1.12.2 HDO.db_0.99.1 cellranger_1.1.0 knitr_1.44 blob_1.2.4 utf8_1.2.3
[127] clue_0.3-65 fs_1.6.3 listenv_0.9.0 pkgbuild_1.4.2 ggplotify_0.1.2 tibble_3.2.1
[133] statmod_1.5.0 callr_3.7.3 tweenr_2.0.2 pkgconfig_2.0.3 tools_4.3.1 cachem_1.0.8
[139] R.cache_0.16.0 RSQLite_2.3.1 viridisLite_0.4.2 DBI_1.1.3 scDblFinder_1.14.0 fastmap_1.1.1
[145] rmarkdown_2.25 scales_1.2.1 usethis_2.2.2 ica_1.0-3 Rsamtools_2.16.0 patchwork_1.1.3.9000
[151] RANN_2.6.1 farver_2.1.1 tidygraph_1.2.3 scatterpie_0.2.1 mgcv_1.9-0 yaml_2.3.7
[157] rtracklayer_1.60.1 cli_3.6.1 purrr_1.0.2 leiden_0.4.3 lifecycle_1.0.3 uwot_0.1.16
[163] Biobase_2.60.0 bluster_1.10.0 sessioninfo_1.2.2 BiocParallel_1.34.2 gtable_0.3.4 rjson_0.2.21
[169] ggridges_0.5.4 progressr_0.14.0 limma_3.56.2 parallel_4.3.1 ape_5.7-1 edgeR_3.42.4
[175] jsonlite_1.8.7 bitops_1.0-7 xgboost_1.7.5.1 bit64_4.0.5 Rtsne_0.16 yulab.utils_0.1.0
[181] BiocNeighbors_1.18.0 spatstat.utils_3.0-3 RcppParallel_5.1.7 metapod_1.8.0 dqrng_0.3.1 GOSemSim_2.26.1
[187] R.utils_2.12.2 lazyeval_0.2.2 shiny_1.7.5 htmltools_0.5.6 enrichplot_1.20.3 GO.db_3.17.0
[193] sctransform_0.4.0 rappdirs_0.3.3 glue_1.6.2 XVector_0.40.0 RCurl_1.98-1.12 treeio_1.24.3
[199] scran_1.28.2 gridExtra_2.3 igraph_1.5.1 TrajectoryUtils_1.8.0 R6_2.5.1 tidyr_1.3.0
[205] SingleCellExperiment_1.22.0 RcppRoll_0.3.0 labeling_0.4.3 cluster_2.1.4 pkgload_1.3.3 aplot_0.2.1
[211] GenomeInfoDb_1.36.3 vipor_0.4.5 tidyselect_1.2.0 ggforce_0.4.1 xml2_1.3.5 AnnotationDbi_1.62.2
[217] future_1.33.0 rsvd_1.0.5 munsell_0.5.0 KernSmooth_2.23-22 data.table_1.14.8 htmlwidgets_1.6.2
[223] fgsea_1.26.0 RColorBrewer_1.1-3 biomaRt_2.56.1 rlang_1.1.1 spatstat.sparse_3.0-2 spatstat.explore_3.2-3
[229] remotes_2.4.2.1 ggnewscale_0.4.9 fansi_1.0.4 parallelDist_0.2.6 beeswarm_0.4.0

zhanghao-njmu commented 10 months ago

It seems that there might be a compatibility issue with the calculate_velocity_genes argument. In SCP version 0.5.3, I have made changes to handle the results generated when calculate_velocity_genes is set to TRUE to avoid potential errors. https://github.com/zhanghao-njmu/SCP/blob/40fe0cda5080fec5fa50d398259c0e153183a6d5/inst/python/SCP_analysis.py#L266-L272 I recommend installing SCP version 0.5.3 and testing it again. If the issue persists, please provide me with a small example dataset and code that reproduces the error so that I can further investigate and assist you.

giorgiatosoni commented 10 months ago

It worked, thank you!