Skip to contents

Convert to tree

Usage

extract_clustering_dendrogram(
  clustering,
  invalid_char_to_replace_regex = "\\(|\\)",
  net_id_width = 20L
)

Arguments

clustering

A nested list given by one of the clusterize function from which to extract the clustering tree.

invalid_char_to_replace_regex

A regex string used by stringr::str_replace_all() to clean net_ids before they are processed.

net_id_width

An integer to truncate long net_id and prevent messy plots. Defaults to 20.

Value

A dendrogram object

Details

This function converts the nested list given by the clusterize functions in Newick tree format that is read by phylogram::read.dendrogram.

The code is adapted from this StackOverflow answer : https://stackoverflow.com/questions/45091691/convert-a-nested-list-in-dendrogram-tree-with-r