scphylo.ul.to_tree#

scphylo.ul.to_tree(df)[source]#

Convert a conflict-free matrix to a tree object.

This function converts a conflict-free matrix to a tree object in which nodes are labled with cells and edges are lables with mutations. The root is labled by ‘root’. Mutations are seperated by .graph[‘splitter_mut’] and cells are seperated by .graph[‘splitter_cell’]. Those mutations that are not present in any cell are stored in .graph[‘become_germline’]. Mutations happed once during the evolution so there is no repetitive mutation.

Parameters

df (pandas.DataFrame) – A genotype dataframe in which rows are cells and columns are mutations. Note that this dataframe must be conflict-free.

Returns

A perfect phylogenetic tree.

Return type

networkx.DiGraph

Examples#

Visualizing a tree in clonal format

Visualizing a tree in clonal format

Visualizing a tree in dendrogram format

Visualizing a tree in dendrogram format