R package for detecting convergent substitutions in phylogenetic trees.
# install.packages("devtools")
devtools::install_github("SamT123/convergence")library(convergence)
# Create tree and sequences object
tree_and_sequences <- makeTreeAndSequences(tree, sequences)
# Add ancestral state reconstruction
tree_and_sequences <- addASRusher(tree_and_sequences, aa_ref, nuc_ref)
# Calculate tree size and nucleotide rates
tree_info <- getTreeSizeAndNucRates(
tree_and_sequences,
noise_model = maxlike_models$normal_model
)
# Get substitution ratios for positions of interest
ratios <- getSubstitutionRatios(
tree_and_sequences,
tree_info$nuc_rates,
tree_info$tree_size_fn,
tree_info$sampling_function,
positions = 1:550
)Requires external tools:
- UShER (matUtils, faToVcf)
- Chronumental (optional, for node dating)