Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in py_call_impl #3

Closed
WhaleGe opened this issue Dec 3, 2023 · 3 comments
Closed

Error in py_call_impl #3

WhaleGe opened this issue Dec 3, 2023 · 3 comments

Comments

@WhaleGe
Copy link

WhaleGe commented Dec 3, 2023

In addition to the previous ARPACK error problem, some of my data kept reporting errors when running fitTPT after running fitTransitionModel. I tried to solve it, but I don’t have any ideas at the moment. I hope you can provide some guidance. Thank you very much.

g_nr_csr <- fitTransitionModel(
anndata_file = "obj_sampled_bcells_assay-RNA_NR.h5ad",
mode = "pseudotime", pseudotime_key = "csr_pot"
)

tpt_nr_csr <- fitTPT(
anndata_file = "obj_sampled_bcells_assay-RNA_NR.h5ad",
CellrankObj = g_nr_csr, group.cells.by = "isotype",
source_state = 'M', target_state = 'A1'
)

100%|██████████| 16590/16590 [00:20<00:00, 798.90cell/s]
WARNING: Biased k-NN graph is disconnected
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Input matrix is not weakly connected. Therefore it has no unique stationary distribution. Separate disconnected components and handle them separately
Calls: fitTPT -> fit_coarse_grain_tpt -> py_call_impl
Execution halted

R version 4.2.1 (2022-06-23)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: ~/Mn/conda/envs/scRNA/lib/libopenblasp-r0.3.21.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 stats graphics grDevices utils datasets methods
[8] base

other attached packages:
[1] ggplot2_3.3.6 cowplot_1.1.1 SeuratObject_4.1.3
[4] Seurat_4.3.0 sciCSR_0.3.1 reticulate_1.25
[7] S4Vectors_0.36.0 BiocGenerics_0.44.0 Matrix_1.5-4

loaded via a namespace (and not attached):
[1] plyr_1.8.7 igraph_1.3.1
[3] lazyeval_0.2.2 sp_1.6-0
[5] splines_4.2.1 BiocParallel_1.32.5
[7] listenv_0.8.0 scattermore_0.8
[9] GenomeInfoDb_1.34.9 digest_0.6.29
[11] htmltools_0.5.2 fansi_1.0.3
[13] magrittr_2.0.3 tensor_1.5
[15] cluster_2.1.3 ROCR_1.0-11
[17] globals_0.15.0 Biostrings_2.66.0
[19] RcppParallel_5.1.5 matrixStats_0.62.0
[21] spatstat.sparse_3.0-1 colorspace_2.0-3
[23] rappdirs_0.3.3 markovchain_0.9.5
[25] ggrepel_0.9.1 dplyr_1.1.3
[27] crayon_1.5.1 RCurl_1.98-1.6
[29] jsonlite_1.8.0 progressr_0.10.0
[31] spatstat.data_3.0-1 survival_3.3-1
[33] zoo_1.8-10 glue_1.6.2
[35] polyclip_1.10-0 gtable_0.3.0
[37] nnls_1.5 zlibbioc_1.44.0
[39] XVector_0.38.0 leiden_0.4.2
[41] DelayedArray_0.24.0 future.apply_1.9.0
[43] abind_1.4-5 scales_1.2.0
[45] spatstat.random_3.1-4 miniUI_0.1.1.1
[47] Rcpp_1.0.8.3 viridisLite_0.4.0
[49] xtable_1.8-4 bit_4.0.4
[51] htmlwidgets_1.5.4 httr_1.4.3
[53] RColorBrewer_1.1-3 ellipsis_0.3.2
[55] ica_1.0-2 pkgconfig_2.0.3
[57] uwot_0.1.14 deldir_1.0-6
[59] utf8_1.2.2 here_1.0.1
[61] tidyselect_1.2.0 rlang_1.1.1
[63] reshape2_1.4.4 later_1.3.0
[65] munsell_0.5.0 tools_4.2.1
[67] cli_3.6.1 generics_0.1.2
[69] pacman_0.5.1 ggridges_0.5.3
[71] stringr_1.4.0 fastmap_1.1.0
[73] goftest_1.2-3 bit64_4.0.5
[75] fitdistrplus_1.1-8 purrr_1.0.2
[77] RANN_2.6.1 pbapply_1.5-0
[79] future_1.26.1 nlme_3.1-157
[81] mime_0.12 hdf5r_1.3.5
[83] compiler_4.2.1 plotly_4.10.0
[85] png_0.1-7 spatstat.utils_3.0-2
[87] tibble_3.2.1 stringi_1.7.12
[89] lattice_0.20-45 SeuratDisk_0.0.0.9021
[91] vctrs_0.6.3 pillar_1.9.0
[93] lifecycle_1.0.3 spatstat.geom_3.1-0
[95] lmtest_0.9-40 RcppAnnoy_0.0.19
[97] data.table_1.14.2 bitops_1.0-7
[99] irlba_2.3.5 httpuv_1.6.5
[101] patchwork_1.1.1 GenomicRanges_1.50.0
[103] R6_2.5.1 promises_1.2.0.1
[105] KernSmooth_2.23-20 gridExtra_2.3
[107] IRanges_2.32.0 parallelly_1.31.1
[109] codetools_0.2-18 MASS_7.3-57
[111] philentropy_0.7.0 SummarizedExperiment_1.28.0
[113] rprojroot_2.0.3 withr_2.5.0
[115] GenomicAlignments_1.34.0 sctransform_0.3.5
[117] Rsamtools_2.14.0 harmony_1.0.3
[119] GenomeInfoDbData_1.2.9 expm_0.999-7
[121] parallel_4.2.1 grid_4.2.1
[123] tidyr_1.2.0 MatrixGenerics_1.10.0
[125] Rtsne_0.16 spatstat.explore_3.1-0
[127] Biobase_2.58.0 shiny_1.7.1

python

anndata 0.9.1
brotlipy 0.7.0
cached-property 1.5.2
cellrank 2.0.1
certifi 2022.12.7
cffi 1.15.1
charset-normalizer 3.1.0
click 8.1.7
colorama 0.4.6
contourpy 1.0.7
cryptography 40.0.1
cycler 0.11.0
deeptime 0.4.4
dill 0.3.6
docrep 0.3.2
fonttools 4.39.3
future 0.18.3
h5py 3.10.0
idna 3.4
igraph 0.11.2
importlib-metadata 6.3.0
importlib-resources 5.12.0
Jinja2 3.0.3
joblib 1.2.0
kiwisolver 1.4.4
llvmlite 0.39.1
loompy 3.0.7
louvain 0.7.1
MarkupSafe 2.1.3
matplotlib 3.7.1
multiprocess 0.70.14
munkres 1.1.4
natsort 8.3.1
networkx 2.8.2
numba 0.56.4
numpy 1.23.5
numpy-groupies 0.10.2
packaging 23.1
pandas 2.0.0
patsy 0.5.3
Pillow 9.5.0
pip 23.0.1
platformdirs 3.2.0
pooch 1.7.0
progressbar2 4.2.0
pycparser 2.21
pygam 0.8.0
pygpcca 1.0.4
pynndescent 0.5.8
pyOpenSSL 23.1.1
pyparsing 3.0.9
PySocks 1.7.1
python-dateutil 2.8.2
python-igraph 0.11.2
python-utils 3.8.1
pytz 2023.3
requests 2.28.2
scanpy 1.9.3
scikit-learn 1.2.2
scipy 1.10.1
scvelo 0.2.5
seaborn 0.12.2
session-info 1.0.0
setuptools 67.6.1
six 1.16.0
statsmodels 0.13.5
stdlib-list 0.8.0
texttable 1.7.0
threadpoolctl 3.1.0
tqdm 4.65.0
typing_extensions 4.5.0
tzdata 2023.3
umap-learn 0.5.3
unicodedata2 15.0.0
urllib3 1.26.15
wheel 0.40.0
wrapt 1.16.0
zipp 3.15.0

@josef0731
Copy link
Collaborator

Hi,

This is not a technical (i.e. software dependency) issue - but a data-related one. Your error/warning messages suggest the neighbour graph constructed to describe the data is disconnected:

WARNING: Biased k-NN graph is disconnected
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Input matrix is not weakly connected. Therefore it has no unique stationary distribution. Separate disconnected components and handle them separately

The warning/error messages are directly from CellRank (hence the py_call...). My guess is the dataset you selected has disparate sets of cells where (transcriptomically) they just are too distinct and therefore end up as separate 'clusters' and therefore the program struggles with predicting transitions between them. We did encounter this when we tested these on datasets and usually it is an indication of us needing to subset data ...

@WhaleGe
Copy link
Author

WhaleGe commented Dec 5, 2023

Hello, I have solved this problem so far. I guess this may still be a technical problem. I speculate that some information may be lost during the conversion process using convertSeuratToH5ad. This problem does not occur when using other software packages that convert rds to h5ad (for example: scdior). Thank you very much for answering my question.

Hi,

This is not a technical (i.e. software dependency) issue - but a data-related one. Your error/warning messages suggest the neighbour graph constructed to describe the data is disconnected:

WARNING: Biased k-NN graph is disconnected
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Input matrix is not weakly connected. Therefore it has no unique stationary distribution. Separate disconnected components and handle them separately

The warning/error messages are directly from CellRank (hence the py_call...). My guess is the dataset you selected has disparate sets of cells where (transcriptomically) they just are too distinct and therefore end up as separate 'clusters' and therefore the program struggles with predicting transitions between them. We did encounter this when we tested these on datasets and usually it is an indication of us needing to subset data ...

@josef0731
Copy link
Collaborator

Glad you have solved your problem - I have been looking into changing the engine behind conversion of the Seurat and AnnData objects - it seems there are better alternatives to SeuratDisk in doing this. Will add this as a To-Do. Thanks again for trying sciCSR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants