Skip to content

Commit 41be47b

Browse files
committed
fixed exception in tl.slide_cells
1 parent 8dda404 commit 41be47b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scFates/tools/slide_cors.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def region_extract(pt_cur, segs_cur, nbranch):
134134
(graph["pp_info"].loc[pps, "time"].values >= pt_cur)
135135
& graph["pp_info"].loc[pps, "seg"].isin(segs_cur).values
136136
]
137-
137+
if len(pp_next) == 0:
138+
raise Exception("win parameter too small, increase number of cells")
138139
cmsm = np.cumsum(
139140
pp_probs[pp_next][np.argsort(graph["pp_info"].loc[pp_next, "time"].values)]
140141
)
@@ -176,6 +177,10 @@ def region_extract(pt_cur, segs_cur, nbranch):
176177
freq = freq + [cell_probs]
177178
pt_cur = graph["pp_info"].loc[pps_region, "time"].max()
178179

180+
# ignore the last node, to avoid infinite recursion
181+
if len(pps_region) == 1:
182+
return freq
183+
179184
if nbranch == 1:
180185
if (
181186
sum(~graph["pp_info"].loc[pps_region, :].seg.isin(seg_progenies))

0 commit comments

Comments
 (0)