KrishnaswamyLab / phateR

PHATE dimensionality reduction method implemented in R
GNU General Public License v2.0
77 stars 9 forks source link

Error message with phate function #62

Closed zyb1984 closed 2 years ago

zyb1984 commented 2 years ago

Describe the bug Calculating PHATE... Running PHATE on 3000 observations and 100 variables. Calculating graph and diffusion operator... Calculating KNN search... Calculated KNN search in 0.97 seconds. Calculating affinities... Calculated affinities in 0.02 seconds. Calculated graph and diffusion operator in 0.99 seconds. Calculating landmark operator... Calculating SVD... Calculated SVD in 0.15 seconds. Calculating KMeans... Calculated KMeans in 1.13 seconds. Calculated landmark operator in 1.28 seconds. Calculated PHATE in 2.27 seconds. Error in py_call_impl(callable, dots$args, dots$keywords) : AttributeError: 'NoneType' object has no attribute 'split'

To Reproduce library(phateR) library(ggplot2) library(readr) library(viridis) library(Rmagic)

load data

bmmsc <- read_csv("https://github.com/KrishnaswamyLab/PHATE/raw/master/data/BMMC_myeloid.csv.gz") bmmsc <- bmmsc[,2:ncol(bmmsc)] bmmsc[1:5,1:10]

keep genes expressed in at least 10 cells

keep_cols <- colSums(bmmsc > 0) > 10 bmmsc <- bmmsc[,keep_cols]

keep cells with at least 1000 UMIs

keep_rows <- rowSums(bmmsc) > 1000 bmmsc <- bmmsc[keep_rows,] bmmsc <- library.size.normalize(bmmsc) bmmsc <- sqrt(bmmsc) bmmsc_PCA <- as.data.frame(prcomp(bmmsc)$x)

run PHATE

bmmsc_PHATE <- phate(bmmsc) library("reticulate") py_module_available("phate")

[1] TRUE

Output of phate.__version__: phate=1.0.8

Output of sessionInfo(): 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=Chinese (Simplified)_China.utf8 [2] LC_CTYPE=Chinese (Simplified)_China.utf8
[3] LC_MONETARY=Chinese (Simplified)_China.utf8 [4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.utf8

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

other attached packages: [1] reticulate_1.25 Rmagic_2.0.3 viridis_0.6.2 viridisLite_0.4.0 [5] readr_2.1.2 ggplot2_3.3.6 phateR_1.0.7 Matrix_1.4-1

Output of reticulate::py_discover_config(required_module = "phate"):

python: C:/ProgramData/Anaconda3/envs/r-reticulate/python.exe libpython: C:/ProgramData/Anaconda3/envs/r-reticulate/python39.dll pythonhome: C:/ProgramData/Anaconda3/envs/r-reticulate version: 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] Architecture: 64bit numpy: C:/ProgramData/Anaconda3/envs/r-reticulate/Lib/site-packages/numpy numpy_version: 1.22.4 phate: C:\PROGRA~3\ANACON~1\envs\R-RETI~1\lib\site-packages\phate__init__.p

python versions found: C:/ProgramData/Anaconda3/envs/r-reticulate/python.exe C:/ProgramData/Anaconda3/python.exe C:/Users/zyb/AppData/Local/R/cache/R/basilisk/1.8.0/0/python.exe

scottgigante commented 2 years ago

I can't reproduce this in my environment, but I might be able to help if you can run

reticulate::py_last_error()

after you encounter the error. Thanks for the detailed report!

zyb1984 commented 2 years ago

All have been solved, and maybe this was caused by chance, and also with "NUll" reply with the check code "reticulate::py_last_error()" Thank you very much.

scottgigante commented 2 years ago

You're welcome!