alignment_to_beast_input_file: Convert an alignment and parameters to a BEAST XML input file

Description Usage Arguments Value Author(s) Examples

Description

Convert an alignment and parameters to a BEAST XML input file

Usage

1
2
alignment_to_beast_input_file(alignment, nspp, rng_seed = 42, beast_filename,
  temp_fasta_filename, crown_age = NA)

Arguments

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

Value

Nothing, creates a file called 'beast_filename'

Author(s)

Richel Bilderbeek

Examples

 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))

richelbilderbeek/wiritttes documentation built on May 27, 2019, 8:14 a.m.