LouisFaure / scFates

a scalable python suite for tree inference and advanced pseudotime analysis from scRNAseq data.
https://scfates.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
49 stars 1 forks source link

RecursionError: maximum recursion depth exceeded in scf.tl.slide_cells #22

Closed willey2020 closed 1 year ago

willey2020 commented 1 year ago

Hello! Thank you again for this great package!

While trying to separate cell windows using scf.tl.slide_cells,

scf.tl.slide_cells(adata_ted,root_milestone="A",milestones=["B","C"],win=110), it shows:


RecursionError Traceback (most recent call last) Cell In[23], line 1 ----> 1 scf.tl.slide_cells(adata_ted,root_milestone="A",milestones=["B","C"],win=110)

File ~/anaconda3/envs/scFates/lib/python3.8/site-packages/scFates/tools/slide_cors.py:242, in slide_cells(adata, root_milestone, milestones, win, mapping, copy, ext) 238 return freq + res1 + res2 240 pt_cur = graph["pp_info"].loc[pps, "time"].min() --> 242 freq = region_extract(pt_cur, segs_cur, len(milestones)) 243 name = root_milestone + "->" + "<>".join(milestones) 245 adata.uns = uns_temp

File ~/anaconda3/envs/scFates/lib/python3.8/site-packages/scFates/tools/slide_cors.py:198, in slide_cells..region_extract(pt_cur, segs_cur, nbranch) 193 return freq + res 195 elif ( 196 sum(~graph["pp_info"].loc[pps_region, :].seg.isin(seg_branch1)) == 0 197 ): --> 198 res = region_extract(pt_cur, segs_cur, nbranch) 199 return freq + res 201 elif ( 202 sum(~graph["pp_info"].loc[pps_region, :].seg.isin(seg_branch2)) == 0 203 ):

File ~/anaconda3/envs/scFates/lib/python3.8/site-packages/scFates/tools/slide_cors.py:198, in slide_cells..region_extract(pt_cur, segs_cur, nbranch) 193 return freq + res ... File ~/anaconda3/envs/scFates/lib/python3.8/site-packages/pandas/core/dtypes/generic.py:41, in create_pandas_abc_type.._check(inst) 40 def _check(inst): ---> 41 return getattr(inst, attr, "_typ") in comp

RecursionError: maximum recursion depth exceeded while calling a Python object

I try to debug and it seems that the after about 15 cycles the parameters are not change any more but the recursion keep going until 10000 times that hit the maximum system limit and stopped.

Could I ask what the potential problem is here? Thank you!

LouisFaure commented 1 year ago

This was due to the algorithm being stuck at the end of a segment if only one node was taken in account for cell assignment, it is now fixed in v1.0.6.

willey2020 commented 1 year ago

Works perfectly! Thank you so much @LouisFaure!!!