lynx.trajectory.prune_tree

lynx.trajectory.prune_tree(adata, tips_to_keep, verbose=False)[source]

Remove unwanted tips by calling scf.tl.cleanup and return the node index mapping.

Parameters:
  • adata (AnnData) – AnnData object with computed principal tree in .uns[‘graph’] This will be modified in-place.

  • tips_to_keep (list) – List of tip node indices to keep

  • verbose (bool) – Print debug information

Returns:

result – Dictionary containing: - ‘branches_removed’: dict mapping original tip -> branch nodes removed - ‘all_nodes_removed’: array of all removed node indices - ‘node_map’: dict mapping original node idx -> new idx after pruning

Return type:

dict