// detect branchings and partition the data into segments
dpt.branchings_segments()
// vector of length n_groups
adata.add["dpt_groups_order"] = [str(n) for n in dpt.segs_names_unique]
// for itips, tips in enumerate(dpt.segs_tips):
// // if tips[0] == -1: adata.add["dpt_groups_order"][itips] = "?"
// if dpt.segs_undecided[itips]: adata.add["dpt_groups_order"][itips] += "?"
After Change
// vector of length n_samples of groupnames
adata.smp["dpt_groups"] = pd.Categorical(
values=dpt.segs_names.astype("U"),
categories=natsorted(np.array(dpt.segs_names_unique).astype("U")))
// the ordering according to segments and pseudotime
ordering_id = np.zeros(adata.n_smps, dtype=int)
for count, idx in enumerate(dpt.indices): ordering_id[idx] = count