knitr::opts_chunk$set(
  collapse = TRUE,
  comment = ""
)
beautier::remove_beautier_folder()
beautier::check_empty_beautier_folder()

Introduction

The purpose of beautier is to create a valid BEAST2 XML input file from its function argument. In this way, a scientific pipeline using BEAST2 can be fully scripted, instead of using BEAUti's GUI.

beautier is part of the babette package suite (website at https://github.com/ropensci/babette). babette allows to use BEAST2 (and its tools) from R.

Demonstration

First, beautier is loaded:

library(beautier)

A BEAST2 XML input file needs an alignment (as BEAST2 infers phylogenies and parameters on DNA sequences). This demonstration uses a testing FASTA file used by beautier:

fasta_filename <- get_beautier_path("test_output_0.fas")

We can display the alignment in the file:

image(ape::read.FASTA(fasta_filename))

Specify the filename for our XML file, here I use a temporary filename, so there is no need to clean up afterwards:

output_filename <- get_beautier_tempfilename()
output_filename

Now we can create our XML file. We do not specify any inference model, and just use the BEAUti default settings:

create_beast2_input_file(
  fasta_filename,
  output_filename
)

The file indeed is a BEAST2 input file:

readLines(output_filename)

This XML input file can be read by BEAST2.

You can use beastier to run BEAST2 from R, see https://github.com/ropensci/beastier. You can use babette to do a BEAST2 inference directly, see https://github.com/ropensci/babette.

Cleanup

file.remove(output_filename)

beautier::remove_beautier_folder()
beautier::check_empty_beautier_folder()


ropensci/beautier documentation built on Nov. 3, 2023, 10:41 a.m.