nanawei11 / Secuer

A clustering method for scRNA-seq data
MIT License
5 stars 0 forks source link

issue #5

Open wwzz-max opened 8 months ago

wwzz-max commented 8 months ago

Hello, sorry to interrupt you. When I was processing my data, I found that this error always occurred. [accran5j3j@01b8bd6d79ac scripts_analysis]$ python generate_kmeans.py --config ../../config/liver_seed2022.yaml 0%| | 0/4 [00:00<?, ?it/s][2024-03-08 08:22:11] [INFO] Selecting representatives... [2024-03-08 08:22:15] [INFO] Approximate KNN... [2024-03-08 08:22:16] [INFO] Selecting representatives... [2024-03-08 08:22:20] [INFO] Approximate KNN... 0%| | 0/4 [00:14<?, ?it/s] Traceback (most recent call last): File "/public/home/accran5j3j/cuts2.0/src/scripts_analysis/helper_generate_kmeans.py", line 32, in generate_kmeans num_workers=num_workers) File "/public/home/accran5j3j/cuts2.0/src/scripts_analysis/helper_generate_kmeans.py", line 78, in phate_clustering num_multiProcesses=4)
File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/secuer/secuer.py", line 365, in secuer outputs = pool.map(func, np.arange(0, cntRepCls, 1)) File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, kwds)) File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/secuer/secuer.py", line 277, in Multi_process_cntRepCls RpFea_m[tmp, :], metric=distance), axis=1) File "<__array_function__ internals>", line 6, in argmin File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 1276, in argmin return _wrapfunc(a, 'argmin', axis=axis, out=out) File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc return bound(args, kwds) ValueError: attempt to get argmin of an empty sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "generate_kmeans.py", line 97, in (H, W, C), latent, label_true, num_workers=num_workers) File "/public/home/accran5j3j/cuts2.0/src/scripts_analysis/helper_generate_kmeans.py", line 36, in generate_kmeans num_workers=num_workers) File "/public/home/accran5j3j/cuts2.0/src/scripts_analysis/helper_generate_kmeans.py", line 78, in phate_clustering num_multiProcesses=4)
File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/secuer/secuer.py", line 365, in secuer outputs = pool.map(func, np.arange(0, cntRepCls, 1)) File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, kwds)) File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/secuer/secuer.py", line 277, in Multi_process_cntRepCls RpFea_m[tmp, :], metric=distance), axis=1) File "<__array_function__ internals>", line 6, in argmin File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 1276, in argmin return _wrapfunc(a, 'argmin', axis=axis, out=out) File "/public/home/accran5j3j/.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc return bound(args, kwds) ValueError: attempt to get argmin of an empty sequence

nanawei11 commented 8 months ago

Hi, Would you mind providing the parameters when you run Secuer? Or could you please attempt to call Secuer without using parallelism and check if it works. I'm looking forward to your feedback. Best, Wei

wwzz-max commented 8 months ago

resC = sr.secuerconsensus(run_secuer=True, fea= latent, Knn=7, M=4, multiProcessState=True, num_multiProcesses=4) These are the parameters I used during the operation. I have tried running it without parallel processing, but the result is still the same.

nanawei11 commented 8 months ago

How did you install Secuer and have you tried running it using the example data? Call secuerconsensus in the way you provided. In theory, there will not appear the log information, like this:

[2024-03-08 08:22:11] [INFO] Selecting representatives..
[2024-03-08 08:22:15] [INFO] Approximate KNN...
[2024-03-08 08:22:16] [INFO] Selecting representatives...

Normally the log information should be:

resC = sr.secuerconsensus(run_secuer=True,
                           fea= fea,
                           Knn=7,
                           M=4,
                           multiProcessState=True,
                           num_multiProcesses=4)
[2024-03-08 10:30:45] [INFO] Running secuer 1
[2024-03-08 10:30:45] [INFO] Running secuer 2
[2024-03-08 10:30:45] [INFO] Running secuer 3
[2024-03-08 10:30:45] [INFO] Running secuer 4

I suggest you reinstall Secuer as follows:

# use anaconda
conda create -n secuer python=3.9
conda activate secuer
pip install secuer matplotlib pandas scanpy igraph louvain pyyaml

Then use the example data to test whether the environment is set up properly.

If you have any questions please feel free to let me know.