tangle_gram {Rtapas}R Documentation

Tanglegram of the host-symbiont frequencies

Description

Maps the estimated (in)congruence metrics of the individual host-symbiont associations as heatmap on a tanglegram. It also plots the average frequency (or residual/corrected frequency) of occurrence of each terminal and optionally, the fast maximum likelihood estimators of ancestral states of each node.

Usage

tangle_gram(
  treeH,
  treeS,
  HS,
  fqtab,
  colscale = "diverging",
  colgrad,
  nbreaks = 50,
  node.tag = TRUE,
  cexpt = 1,
  link.lwd = 1,
  link.lty = 1,
  fsize = 0.5,
  pts = FALSE,
  link.type = "straight",
  ftype = "i",
  ...
)

Arguments

treeH

Host phylogeny. An object of class "phylo".

treeS

Symbiont phylogeny. An object of class "phylo".

HS

Host-symbiont association matrix.

fqtab

Dataframe produced with max_cong() or max_incong().

colscale

Choose between "diverging", color reflects distance from 0 (centered at 0, recommended if "res.fq = TRUE") or "sequential", color reflects distance from minimum value (spanning from the min to max frequencies observed).

colgrad

Vector of R specified colors defining the color gradient of the heatmap.

nbreaks

Number of discrete values along "colgrad".

node.tag

Specifies whether maximum likelihood estimators of ancestral states are to be computed. Default is TRUE.

cexpt

Size of color points at terminals and nodes.

link.lwd

Line width for plotting, default to 1.

link.lty

Line type. Coded as lty in par().

fsize

Relative font size for tip labels.

pts

Logical value indicating whether or not to plot filled circles at each vertex of the tree, as well as at transition points between mapped states. Default is FALSE.

link.type

If curved linking lines are desired, set to "curved". Default is "straight".

ftype

Font type. Options are "reg", "i" (italics), "b" (bold) or "bi" (bold-italics).

...

Any graphical option admissible in phytools::plot.cophylo()

Value

A tanglegram with quantitative information displayed as heatmap.

NOTE

In order to calculate the ancestral states in the phylogenies, all nodes of the trees (node.label) must have a value (NA or empty values are not allowed). In addition, the trees must be time-calibrated and preferably rooted. If one of these elements is missing, an error will be generated and nodes and points of terminals will be displayed as black.

Examples

data(nuc_cp)
N = 10 #for the example, we recommend 1e+4 value
n = 8
NPc <- max_cong(np_matrix, NUCtr, CPtr, n, N, method = "paco",
                symmetric = TRUE, ei.correct = "sqrt.D",
                percentile = 0.01, res.fq = FALSE,
                strat = "parallel", cl = 4)
col = c("darkorchid4", "gold")
tangle_gram(NUCtr, CPtr, np_matrix, NPc, colscale = "sequential",
            colgrad = col, nbreaks = 50, node.tag = TRUE)



[Package Rtapas version 1.2 Index]