chromePlus

What it does. chromePlus is an R package developed in the Blackmon Lab that extends the chromEvol framework within the diversitree ecosystem. It fits Markov chain models of chromosome number evolution on phylogenies using MCMC and crucially allows a binary trait (such as sex determination system, mating strategy, or presence of B chromosomes) to influence the rates of chromosome change. Modeled events include chromosome gain (ascending dysploidy), loss (descending dysploidy), polyploidy, and demiploidy. The binary trait adds a second dimension to the state space: each chromosome number x binary-state combination becomes a distinct state, and the model tests whether rates differ between the two states.

When to use it.

When NOT to use it.

Worked example

library(chromePlus)
library(diversitree)

# dat: data.frame with columns:
#   species  — character, matching tree$tip.label
#   haploid_chrom — integer haploid chromosome count
#   prob_state_A  — numeric 0..1, probability of binary state A
#                   (use 0 or 1 for hard assignments; intermediate values
#                    integrate over tip uncertainty)
# tree: phylo object (ape format), time-calibrated

# 1. Build a probability matrix over chromosome states x binary states
pmat <- datatoMatrix(x = dat,
                     range = c(5, 25),    # must bracket all observed counts
                     hyper = TRUE,
                     state.names = c("A", "B"))

# 2. Build a diversitree mkn likelihood from the matrix
lik <- make.mkn(tree, pmat, strict = FALSE,
                control = list(method = "ode"))

# 3. Constrain to the chromePlus rate scheme
con.lik <- constrainMkn(data = pmat, lik = lik,
                        state.names = c("A", "B"))

# 4. Run MCMC through diversitree
inits <- startVals(n = 10, min = 0, max = 0.2)
post  <- mcmc(con.lik, x.init = inits, nsteps = 5000, w = 0.1)

# 5. Inspect convergence — effective sample size for each rate
library(coda)
post_mcmc <- as.mcmc(post[-(1:1000), ])   # discard burn-in
effectiveSize(post_mcmc)

# 6. Compute ΔR for gain rate: (rate in state A) - (rate in state B)
delta_R_gain <- post[-(1:1000), "asc.A"] - post[-(1:1000), "asc.B"]
quantile(delta_R_gain, c(0.025, 0.5, 0.975))

# 7. Plot posterior densities
plotChromeplus(data = post[-(1:1000), c("asc.A", "asc.B")],
               colors = c("#fb923c", "#500000"),
               x_title = "chromosome gain rate",
               main_title = "Gain rate: state A vs B")

Gotchas we’ve hit

Key papers that use this method in the lab

Question copied. Paste it into the NotebookLM tab.