plot_tree_pa: plot_tree_pa

View source: R/plot_tree_pa.R

plot_tree_paR Documentation

plot_tree_pa

Description

Plots a phylogeny alongside a presence/absence matrix of user selected genes.

Usage

plot_tree_pa(
  tree,
  pa,
  genes = colnames(pa),
  align = TRUE,
  order = TRUE,
  plot_titles = c("phylogeny", "gene presence/absence"),
  text_size = 14,
  label_genes = TRUE,
  label_tips = TRUE,
  cols = NULL
)

Arguments

tree

a phylogeny in 'phylo' format

pa

binary presence/absence matrix

genes

a vector of gene to include in the plot. Must be a subset of colnames(pa)

align

whether or not to align the tips of the phylogeny with the presence/absence matrix using dotted lines

order

whether to order the genes based upon their presence/absence pattern

plot_titles

the subplot titles (default=c('phylogeny', 'gene presence/absence'))

text_size

adjusts the size of text in the plot

label_genes

whether to print the gene labels in the presence/absence matrix

label_tips

whether to print the tree tip labels

cols

colours for the gene presence/absence matrix. These will be recycled if #genes > #colours.

Value

a patchwork object plotting the phylogeny alongside the gene presence/absence matrix

Examples


sim <- simulate_pan(rate=1e-3)
genes <- colnames(sim$pa)[which(apply(sim$pa, 2, sd)>0.2)]
plot_tree_pa(sim$tree, sim$pa, genes=genes, 
             label_genes=FALSE, label_tips=FALSE, cols='black')


gtonkinhill/panstripe documentation built on Feb. 27, 2025, 9:01 p.m.