GuangyuWangLab2021 / cellDancer

Predict RNA velocity through deep learning
https://guangyuwanglab2021.github.io/cellDancer_website/
BSD 3-Clause "New" or "Revised" License
60 stars 11 forks source link

pseudo_time() error: MAX_ALLOWED_TERM_CELLS=MAX_ALLOWED_TERM_CELLS #29

Open Thapeachydude opened 6 months ago

Thapeachydude commented 6 months ago

Hi,

I'm getting an error during peudo_time():


  File "/cluster/work/moor/.snakemake/conda/bf69db601187e32c2ff18c90452fc61d_/lib/python3.7/site-packages/celldancer/pseudo_time.py", line 419, in recur_cell_time_assignment_intracluster
    MAX_ALLOWED_TERM_CELLS=MAX_ALLOWED_TERM_CELLS)
  File "/cluster/work/moor/.snakemake/conda/bf69db601187e32c2ff18c90452fc61d_/lib/python3.7/site-packages/celldancer/pseudo_time.py", line 419, in recur_cell_time_assignment_intracluster
    MAX_ALLOWED_TERM_CELLS=MAX_ALLOWED_TERM_CELLS)
  File "/cluster/work/moor/.snakemake/conda/bf69db601187e32c2ff18c90452fc61d_/lib/python3.7/site-packages/celldancer/pseudo_time.py", line 419, in recur_cell_time_assignment_intracluster
    MAX_ALLOWED_TERM_CELLS=MAX_ALLOWED_TERM_CELLS)
  [Previous line repeated 993 more times]
  File "/cluster/work/moor/.snakemake/conda/bf69db601187e32c2ff18c90452fc61d_/lib/python3.7/site-packages/celldancer/pseudo_time.py", line 384, in recur_cell_time_assignment_intracluster
    n_jobs = n_jobs)
  File "/cluster/work/moor/.snakemake/conda/bf69db601187e32c2ff18c90452fc61d_/lib/python3.7/site-packages/celldancer/diffusion.py", line 606, in run_diffusion
    paths = pool.starmap(diffusion_off_grid_wallbound, TASKS)
  File "/cluster/work/moor/.snakemake/conda/bf69db601187e32c2ff18c90452fc61d_/lib/python3.7/multiprocessing/pool.py", line 276, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/cluster/work/moor/.snakemake/conda/bf69db601187e32c2ff18c90452fc61d_/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '[array([[0.03990202, 0.17572133],
       [0.04033924, 0.18255856],
       [0.03917042, 0.18930933],
       [0.04310531, 0.19491786],
       [0.03820762, 0.19970864]])]'. Reason: 'RecursionError('maximum recursion depth exceeded while calling a Python object')'

The steps I'm running before are:

print("Running celldancer")
loss_df, celldancer_df = celldancer.velocity(in_df, gene_list = None, \
                                    permutation_ratio = 0.125, \
                                    n_jobs = opt["ncores"])

print("Projecting velocity onto embedding")
celldancer_df = celldancer.compute_cell_velocity(cellDancer_df = celldancer_df, \
                                         projection_neighbor_choice = "gene", \
                                         expression_scale = "power10", projection_neighbor_size=10, \
                                         speed_up=(100,100))

## Estimate pseudo-time
print("Estimating pseudo-time")
# set parameters
dt = 0.05
t_total = {dt:int(10/dt)}
n_repeats = 10

if opt["onlytumor"] == True: 
    n_paths = 2
    print("Using only tumor cells")
else:
    print("Using all celltypes - paths set to number of celltypes")
    n_paths = len(in_df["clusters"].unique()) # we assume a single trajectory per celltype

print("Paths set to: ", n_paths)

celldancer_df = celldancer.pseudo_time(cellDancer_df = celldancer_df, \
                       grid = (30, 30), dt = dt, t_total = t_total[dt], \
                       n_repeats = 10, speed_up = (100, 100), n_paths = n_paths, \
                       plot_long_trajs = True, \
                       psrng_seeds_diffusion = [i for i in range(n_repeats)]
                                      )

I only see this for some of my samples, the others work fine.

Best, M