plotClustersTree: Plot phylogenetic tree clusters as phylogram

Description Usage Arguments Value Author(s) References Examples

View source: R/ClustPlot.R

Description

A function that plots a phylogenetic tree with a given clustering scheme and given options of coloring scheme and whether to show the leaf names.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plotClustersTree(
  tree,
  clustering,
  col.palette = NULL,
  show.centers = NULL,
  center.symbol = " * ",
  symbol.cex = 1,
  node.cex = 1,
  title = "Tree Clusters"
)

Arguments

tree

A phylo tree object.

clustering

An positive integer vector, usually the from the output of clustPAM, indicating index of specific colors from the palette. The integers in this vector must be at most the length of palette. Values of 0 indicate that the node is not assigned a cluster and therefore will not be labeled. If show.centers is not NULL, then all cluster centers indicated in the show.centers must not have a clustering value of 0. clustering should be the same length as the number of leaves in the tree.

col.palette

A character vector indicating the colors used for different clusters. If no value is given, the palette will be generated from rainbow.

show.centers

A character vector indicating leaf names of the cluster centers. Default value is NULL.

center.symbol

A character vector indicating the symbol or text representative of the cluster centers. Default value is " * ". If the length of center.symbol is less than the number of cluster centers specified in show.centers, then the symbols are recycled. This argument is ignored when show.centers is NULL.

symbol.cex

A numeric indicating factor scaling of center symbols. Default value is 1. This can be a numeric vector indicating scaling of each symbol. If the vector is shorter than the number of cluster centers, the numbers will be recycled. This argument is ignored if show.centers is NULL.

node.cex

A numeric indicating factor scaling of node circles. Default value is 1. This can be a numeric vector indicating scaling of each node (that is not a cluster center). If the vector is shorter than the number of nodes, the numbers will be recycled.

title

A character string indicating the title of the plot. Default value is "Tree Clusters".

Value

Returns a phylogram with different colors indicating different clusters.

Author(s)

Yuzi Li, rainal.li@mail.utoronto.ca

References

Paradis E, Schliep K (2019). “ape 5.0: an environment for modern phylogenetics and evolutionary analyses in R.” Bioinformatics, 35, 526-528.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Example 1
# Make 6 clusters from a newick tree using PAM
pam <- clustPAM(6, text = NwkTree2)
# Plot the pam clusters
plotClustersTree(pam$phyloTree,
                 pam$clustering,
                 show.centers = pam$medoids,
                 center.symbol = pam$medoids)

# Example 2
# Make 6 clusters from a newick tree using EM
em <- clustEM(6, text = NwkTree2)
# Plot the em clusters
plotClustersTree(em$phyloTree, em$clustering)

rainali475/ClustPhy documentation built on Dec. 22, 2021, 12:03 p.m.