Closed lzj1769 closed 1 year ago
Dear Zhijian: Thank you for your interest in our study. I've sent you a tiny demo to your google gmail.
Best wishes Wanwan
Hi Wanwan,
Thank you very much for sending the demo. With the new code, the method works pretty well!
Best, Zhijian
Hi,
I got the following error when running the function identify_spatial_genes:
`100%|██████████| 128/128 [00:19<00:00, 6.62it/s]
RemoteTraceback Traceback (most recent call last) RemoteTraceback: """ Traceback (most recent call last): File "/data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "/data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "/data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/site-packages/parmap/parmap.py", line 105, in _func_star_many return func_items_args[0](*list(func_items_args[1]) + func_items_args[2], File "/data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/site-packages/scGCO/Graph_cut.py", line 640, in compute_spatial_genomewise_optimize newLabels, thresholds,label_pred = cut_graph_general_otsu(cellGraph, exp, unary_scale_factor, File "/data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/site-packages/scGCO/Graph_cut.py", line 1348, in cut_graph_general_otsu pair_size = thresholds.shape[0] + 1 IndexError: tuple index out of range """
The above exception was the direct cause of the following exception:
IndexError Traceback (most recent call last) Cell In[17], line 1 ----> 1 df = identify_spatial_genes(locs, data, cellGraph, gmmDict, smooth_factor=5)
File /data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/site-packages/scGCO/Graph_cut.py:729, in identify_spatial_genes(locs, data_norm, cellGraph, gmmDict, smooth_factor, unary_scale_factor, label_cost, algorithm, ncores) 716 ttt = np.array_split(data_norm,num_cores,axis=1) 717 tuples = [(l, d, c, g,ww,nn, s, u, b, a) for l, d, c, g,ww,nn, s, u, b, a in zip( 718 repeat(locs, num_cores), 719 ttt, (...) 726 repeat(label_cost, num_cores), 727 repeat(algorithm, num_cores))] --> 729 results = parmap.starmap(compute_spatial_genomewise_optimize, tuples, 730 pm_processes=num_cores, pm_pbar=True) 732 # pool.close() 733 # p_values, genes, diff_p_values, exp_diff, smooth_factors, pred_labels, model_results 734 nnn = [results[i][0] for i in np.arange(len(results))]
File /data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/site-packages/parmap/parmap.py:317, in starmap(function, iterables, *args, *kwargs) 299 def starmap(function, iterables, args, **kwargs): 300 """ Equivalent to: 301 >>> return ([function(x1,x2,x3,..., args[0], args[1],...) for 302 >>> (x1,x2,x3...) in iterable]) (...) 315 :type pm_pbar: bool or dict 316 """ --> 317 return _map_or_starmap(function, iterables, args, kwargs, "starmap")
File /data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/site-packages/parmap/parmap.py:273, in _map_or_starmap(function, iterable, args, kwargs, map_or_starmap) 271 _do_pbar(result, num_tasks, chunksize, tqdm_options=tqdm_options) 272 finally: --> 273 output = result.get() 274 if close_pool: 275 pool.join()
File /data/pinello/SHARED_SOFTWARE/anaconda_latest/envs/scGCO/lib/python3.9/multiprocessing/pool.py:771, in ApplyResult.get(self, timeout) 769 return self._value 770 else: --> 771 raise self._value
IndexError: tuple index out of range`
How can I solve this issue?
Thanks and best, Zhijian