README.md

treeduckenTools

The goal of treeduckenTools is to provide R scripts to assist in the use of the treeducken simulator. R functions within can be used to print settings files, determine input parameters for treeducken, and a wrapper around SeqGen is provided to generate sequence alignments from simulator output. For more on treeducken see the Github page.

Installation

You can install the released version of treeduckenTools from Github with:

library(devtools)
install_github("wadedismukes/treeduckenTools")

Example

To print out a settings file for treeducken you could do the following.

## generate parameters from distributions
sd1 <- 1859
set.seed(sd1)
# get a birth and death rate
rates <- sort(rexp(2, rate = 5))
# set birth rate to the larger of the two (treeducken will not simulate if 
# birth rate is lower than death rate)
sp_birth_rate <- rates[2]
sp_death_rate <- rates[1]

replicate_species_trees <- 10
num_taxa <- 10
# how long do we expect our tree to be? helpful in determining locus level
# parameters.
exp_tree_length <- calc_expected_bdtree_length(sp_birth_rate,
                                               sp_deat_rate,
                                               num_taxa)

# no transfers
transfer_rate <- 0

gene_birth_rate <- 2 / exp_tree_length
gene_death_rate <- 1 / exp_tree_length
number_loci <- 10

# turn off gene trees
ind_per_pop <- 1
pop_size <- 1
number_genes <- 1

# random number seed 


# make settings list for writing function
settings_list <- make_td_settings_list(sp_birth_rate,
                                        sp_death_rate,
                                        transfer_rate,
                                        gene_birth_rate,
                                        gene_death_rate,
                                        num_taxa,
                                        ind_per_pop,
                                        pop_size,
                                        replicate_species_trees,
                                        number_loci,
                                        number_genes,
                                        sd1)

output_prefix <- "test"

# write the file
write_td_settings(settings_list, output_prefix)



wadedismukes/treeduckenTools documentation built on Aug. 14, 2019, 2:14 a.m.