Description Usage Arguments Value Author(s) Examples
Convert an alignment and parameters to a BEAST XML input file
1 2 | alignment_to_beast_input_file(alignment, nspp, rng_seed = 42, beast_filename,
temp_fasta_filename, crown_age = NA)
|
alignment |
the DNA alignment of type DNAbin |
nspp |
the number of states in a BEAST2 MCMC chain, typically there is one state per one thousand generations |
rng_seed |
random number generator seed |
beast_filename |
the filename of the XML BEAST2 input file created |
temp_fasta_filename |
the name of a temporary file created |
crown_age |
a postive value should the crown age be fixed at that value, NA if BEAST2 needs to estimate it |
Nothing, creates a file called 'beast_filename'
Richel Bilderbeek
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Simulate a phylogeny
phylogeny <- ape::rcoal(n = 5)
# Simulate an alignment from that phylogeny
alignment <- convert_phylogeny_to_alignment(
phylogeny = phylogeny,
sequence_length = 10
)
# Create a BEAST2 input file
beast_xml_input_file <- "alignment_to_beast_input_file_example.xml"
fasta_filename <- "alignment_to_beast_input_file_examp.fasta"
alignment_to_beast_input_file(
alignment = alignment,
nspp = 10,
rng_seed = 42,
beast_filename = beast_xml_input_file,
temp_fasta_filename = fasta_filename,
crown_age = NA
)
# Check that the BEAST2 input file really exists
testit::assert(file.exists(beast_xml_input_file))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.