Closed waniwal closed 3 months ago
Hi @waniwal
Which datasets are you using. Could you provide some detailed infomation about the data and your codes for debugging?
Best
This issue was closed because it has been stalled for long time with no activity. Feel free to reopen it.
Hello, I encountered the following error when running this function: matching_list, zip_res = run_SLAT_multi([adata1,adata2,adata3,adata4],k_cutoff=10,feature = "PCA")
ValueError: Input X contains NaN.
But there are no NAN or NA in my data.How do I fix this?
Detailed information: Traceback (most recent call last): File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 463, in _process_worker r = call_item() File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 291, in call return self.fn(*self.args, self.kwargs) File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 589, in call return [func(*args, *kwargs) File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 589, in
return [func( args, kwargs)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/scSLAT/model/utils.py", line 304, in parall_SLAT
edges, features = load_anndatas([a1, a2], feature=feature, check_order=False)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/scSLAT/model/loaddata.py", line 234, in load_anndatas
sc.tl.pca(adata_all)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/scanpy/preprocessing/_pca.py", line 188, in pca
Xpca = pca.fit_transform(X)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/utils/_set_output.py", line 157, in wrapped
data_to_wrap = f(self, X, *args, *kwargs)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/base.py", line 1152, in wrapper
return fit_method(estimator, args, kwargs)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/decomposition/_pca.py", line 460, in fit_transform
U, S, Vt = self._fit(X)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/decomposition/_pca.py", line 483, in _fit
X = self._validate_data(
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/base.py", line 605, in _validate_data
out = check_array(X, input_name="X", check_params)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/utils/validation.py", line 957, in check_array
_assert_all_finite(
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/utils/validation.py", line 122, in _assert_all_finite
_assert_all_finite_element_wise(
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/sklearn/utils/validation.py", line 171, in _assert_all_finite_element_wise
raise ValueError(msg_err)
ValueError: Input X contains NaN.
PCA does not accept missing values encoded as NaN natively. For supervised learning, you might want to consider sklearn.ensemble.HistGradientBoostingClassifier and Regressor which accept missing values encoded as NaNs natively. Alternatively, it is possible to preprocess the data, for instance by using an imputer transformer in a pipeline or drop samples with missing values. See https://scikit-learn.org/stable/modules/impute.html You can find a list of all estimators that handle NaN values at the following page: https://scikit-learn.org/stable/modules/impute.html#estimators-that-handle-nan-values
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "test_v1.py", line 179, in
matching_list, zip_res = run_SLAT_multi([adata1,adata2,adata3,adata4],k_cutoff=10,feature = "PCA")
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/scSLAT/model/utils.py", line 309, in run_SLAT_multi
unfiltered_zip_res = Parallel(n_jobs=n_jobs)(delayed(parall_SLAT)(a1,a2,i)\
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 1952, in call
return output if self.return_generator else list(output)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 1595, in _get_outputs
yield from self._retrieve()
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 1699, in _retrieve
self._raise_error_fast()
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 1734, in _raise_error_fast
error_job.get_result(self.timeout)
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 736, in get_result
return self._return_or_raise()
File "/share/home/luxj/software/miniconda3/envs/scSLAT/lib/python3.8/site-packages/joblib/parallel.py", line 754, in _return_or_raise
raise self._result
ValueError: Input X contains NaN.
PCA does not accept missing values encoded as NaN natively. For supervised learning, you might want to consider sklearn.ensemble.HistGradientBoostingClassifier and Regressor which accept missing values encoded as NaNs natively. Alternatively, it is possible to preprocess the data, for instance by using an imputer transformer in a pipeline or drop samples with missing values. See https://scikit-learn.org/stable/modules/impute.html You can find a list of all estimators that handle NaN values at the following page: https://scikit-learn.org/stable/modules/impute.html#estimators-that-handle-nan-values
Sessioninfo: Package Version
anndata 0.9.2 asttokens 2.4.1 attrs 23.1.0 backcall 0.2.0 Brotli 1.1.0 certifi 2023.7.22 charset-normalizer 3.3.2 colorama 0.4.6 comm 0.2.0 contourpy 1.1.1 cycler 0.12.1 debugpy 1.8.0 decorator 5.1.1 executing 2.0.1 faiss-cpu 1.7.4 fastjsonschema 2.19.0 filelock 3.13.1 fonttools 4.44.1 fsspec 2023.10.0 get-annotations 0.1.2 h5py 3.10.0 harmony-pytorch 0.1.7 idna 3.4 igraph 0.10.8 importlib-metadata 6.8.0 importlib-resources 6.1.1 ipykernel 6.26.0 ipython 8.12.3 jedi 0.19.1 Jinja2 3.1.2 joblib 1.3.2 jsonschema 4.19.2 jsonschema-specifications 2023.11.1 jupyter_client 8.6.0 jupyter_core 5.5.0 kiwisolver 1.4.5 leidenalg 0.10.1 llvmlite 0.41.1 MarkupSafe 2.1.3 matplotlib 3.6.3 matplotlib-inline 0.1.6 mkl-fft 1.3.8 mkl-random 1.2.4 mkl-service 2.4.0 mpmath 1.3.0 natsort 8.4.0 nbformat 5.9.2 nest-asyncio 1.5.8 networkx 3.1 numba 0.58.1 numpy 1.24.4 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu12 8.9.2.26 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu12 2.18.1 nvidia-nvjitlink-cu12 12.3.52 nvidia-nvtx-cu12 12.1.105 opencv-python 4.8.1.78 packaging 23.2 pandas 2.0.3 parso 0.8.3 patsy 0.5.3 pexpect 4.8.0 pickleshare 0.7.5 Pillow 10.1.0 pip 23.3.1 pkgutil_resolve_name 1.3.10 platformdirs 4.0.0 plotly 5.18.0 pooch 1.8.0 prompt-toolkit 3.0.41 psutil 5.9.5 ptyprocess 0.7.0 pure-eval 0.2.2 pyg-lib 0.3.1+pt21cpu Pygments 2.16.1 pynndescent 0.5.10 pynvml 11.5.0 pyparsing 3.1.1 PySocks 1.7.1 python-dateutil 2.8.2 pytz 2023.3.post1 PyYAML 6.0.1 pyzmq 25.1.1 referencing 0.31.0 requests 2.31.0 rpds-py 0.12.0 scanpy 1.9.6 scikit-learn 1.3.2 scikit-misc 0.2.0 scipy 1.10.1 scslat 0.2.1 seaborn 0.12.2 session-info 1.0.0 setuptools 68.2.2 six 1.16.0 stack-data 0.6.3 statsmodels 0.14.0 stdlib-list 0.9.0 sympy 1.12 tbb 2021.11.0 tenacity 8.2.3 texttable 1.7.0 threadpoolctl 3.2.0 torch 2.1.0 torch-cluster 1.6.3+pt21cpu torch_geometric 2.4.0 torch-scatter 2.1.2+pt21cpu torch-sparse 0.6.18+pt21cpu torch-spline-conv 1.2.2+pt21cpu torchaudio 2.1.0 torchvision 0.16.0 tornado 6.3.3 tqdm 4.66.1 traitlets 5.13.0 triton 2.1.0 typing_extensions 4.8.0 tzdata 2023.3 umap-learn 0.5.4 urllib3 2.1.0 wcwidth 0.2.10 wheel 0.41.3 zipp 3.17.0