Title: | Call 'BEAST2' |
---|---|
Description: | 'BEAST2' (<https://www.beast2.org>) is a widely used Bayesian phylogenetic tool, that uses DNA/RNA/protein data and many model priors to create a posterior of jointly estimated phylogenies and parameters. 'BEAST2' is a command-line tool. This package provides a way to call 'BEAST2' from an 'R' function call. |
Authors: | Richèl J.C. Bilderbeek [aut, cre] , Joëlle Barido-Sottani [rev] (Joëlle reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/209), David Winter [rev] (David reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/209), Jason Griffiths [ctb] , Olivier Roy [ctb], Thijs Janzen [ctb] |
Maintainer: | Richèl J.C. Bilderbeek <[email protected]> |
License: | GPL-3 |
Version: | 2.5.2 |
Built: | 2024-12-03 05:58:28 UTC |
Source: | https://github.com/ropensci/beastier |
Add quotes around the string if it contains spaces. Does nothing if the string contains no spaces. This is used for filenames
add_quotes_if_has_spaces(filename)
add_quotes_if_has_spaces(filename)
filename |
a filename |
a filename. If the filename did not contain spaces, it is returned as-is. If the filename did contain spaces, the filename is surrounded by quotes
Richèl J.C. Bilderbeek
remove_beaustier_folders() check_empty_beaustier_folders() add_quotes_if_has_spaces("x") add_quotes_if_has_spaces("a b") check_empty_beaustier_folders()
remove_beaustier_folders() check_empty_beaustier_folders() add_quotes_if_has_spaces("x") add_quotes_if_has_spaces("a b") check_empty_beaustier_folders()
Would these lines of text, when written to a file, result in a valid BEAST2 input file?
are_beast2_input_lines( lines, verbose = FALSE, method = ifelse(beautier::is_on_ci(), "deep", "fast"), beast2_path = get_default_beast2_path() )
are_beast2_input_lines( lines, verbose = FALSE, method = ifelse(beautier::is_on_ci(), "deep", "fast"), beast2_path = get_default_beast2_path() )
lines |
lines of text |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
method |
the method to check. Can be 'deep' or 'fast'. The 'deep' method uses BEAST2 to validate the complete file. The 'fast' method uses some superficial tests (for example: if all IDs are unique) |
beast2_path |
name of either a BEAST2 binary file
(usually simply |
TRUE if the text is valid, FALSE if not
Richèl J.C. Bilderbeek
Use is_beast2_input_file
to check a file
if (is_beast2_installed() && beautier::is_on_ci()) { are_beast2_input_lines(get_beastier_path("anthus_2_4.xml")) remove_beaustier_folders() } check_empty_beaustier_folders()
if (is_beast2_installed() && beautier::is_on_ci()) { are_beast2_input_lines(get_beastier_path("anthus_2_4.xml")) remove_beaustier_folders() } check_empty_beaustier_folders()
Would these lines of text, when written to a file, result in a valid BEAST2 input file?
are_beast2_input_lines_deep( lines, verbose = FALSE, beast2_path = get_default_beast2_path() )
are_beast2_input_lines_deep( lines, verbose = FALSE, beast2_path = get_default_beast2_path() )
lines |
lines of text |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
beast2_path |
name of either a BEAST2 binary file
(usually simply |
TRUE if the text is valid, FALSE if not
Richèl J.C. Bilderbeek
Use is_beast2_input_file
to check a file
if (is_beast2_installed() && beautier::is_on_ci()) { beast2_filename <- get_beastier_path("anthus_2_4.xml") text <- readLines(beast2_filename) are_beast2_input_lines_deep(text) remove_beaustier_folders() } check_empty_beaustier_folders()
if (is_beast2_installed() && beautier::is_on_ci()) { beast2_filename <- get_beastier_path("anthus_2_4.xml") text <- readLines(beast2_filename) are_beast2_input_lines_deep(text) remove_beaustier_folders() } check_empty_beaustier_folders()
Would these lines of text, when written to a file, result in a valid BEAST2 input file?
are_beast2_input_lines_fast(lines)
are_beast2_input_lines_fast(lines)
lines |
lines of text |
TRUE if the text is valid, FALSE if not
Richèl J.C. Bilderbeek
Use is_beast2_input_file
to check a file
beast2_filename <- get_beastier_path("anthus_2_4.xml") text <- readLines(beast2_filename) # TRUE are_beast2_input_lines_fast(text) check_empty_beaustier_folders()
beast2_filename <- get_beastier_path("anthus_2_4.xml") text <- readLines(beast2_filename) # TRUE are_beast2_input_lines_fast(text) check_empty_beaustier_folders()
Determines if the two alignments are equal
are_identical_alignments(p, q)
are_identical_alignments(p, q)
p |
the first alignment |
q |
the second alignment |
TRUE or FALSE
Richèl J.C. Bilderbeek
beast2_options
to a tableConvert a beast2_options
to a table
beast2_options_to_table(beast2_options)
beast2_options_to_table(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
a tibble with two columns, called 'parameter' and 'value'. Each 'parameter' is the name of the element of the 'beast2_options' structure, where the 'value' on the same row holds the value of that parameter
Richèl J.C. Bilderbeek
beast2_options_to_table(create_beast2_options())
beast2_options_to_table(create_beast2_options())
Creates a beastier report, to be used when reporting bugs. Uses message
beastier_report( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
beastier_report( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
beast2_folder |
the folder where the BEAST2 is installed. Note that this is not the folder where the BEAST2 executable is installed: the BEAST2 executable is in a subfolder. Use get_default_beast2_folder to get the default BEAST2 folder. Use get_default_beast2_bin_path to get the full path to the default BEAST2 executable. |
os |
name of the operating system,
must be |
No return value, the information will be shown using message
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() beastier_report() check_empty_beaustier_folders()
check_empty_beaustier_folders() beastier_report() check_empty_beaustier_folders()
BEAST2
is installed properly.Calls stop if BEAST2 is improperly installed
check_beast2(beast2_path = get_default_beast2_path())
check_beast2(beast2_path = get_default_beast2_path())
beast2_path |
name of either a BEAST2 binary file
(usually simply |
nothing Will stop if BEAST2 is improperly installed
Richèl J.C. Bilderbeek
if (is_beast2_installed()) { check_beast2() }
if (is_beast2_installed()) { check_beast2() }
beast2_options
is a valid BEAST2 options object.Calls stop
if the BEAST2 option object is invalid
check_beast2_options(beast2_options)
check_beast2_options(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
nothing
Will stop
if the BEAST2 option object is invalid
Richèl J.C. Bilderbeek
Use create_beast2_options to create a valid BEAST2 options object
check_empty_beaustier_folders() check_beast2_options(create_beast2_options()) check_empty_beaustier_folders()
check_empty_beaustier_folders() check_beast2_options(create_beast2_options()) check_empty_beaustier_folders()
beast2_options
, which is a list,
has all elements of the right data typesCalls stop
if not.
check_beast2_options_data_types(beast2_options)
check_beast2_options_data_types(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
nothing
Richèl J.C. Bilderbeek
Use check_beast2_options to check
the entire beast2_options
object
Check if the beast2_options
will not overwrite
existing files, when the 'overwrite' options is set to FALSE
.
check_beast2_options_do_not_overwrite_existing_files(beast2_options)
check_beast2_options_do_not_overwrite_existing_files(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Will stop if a file is threatened to be overwritten
Nothing. Will stop if a file is threatened to be overwritten
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() check_beast2_options_do_not_overwrite_existing_files( beast2_options = create_beast2_options() ) check_empty_beaustier_folders()
check_empty_beaustier_folders() check_beast2_options_do_not_overwrite_existing_files( beast2_options = create_beast2_options() ) check_empty_beaustier_folders()
beast2_options
differCalls stop
if not.
check_beast2_options_filenames_differ(beast2_options)
check_beast2_options_filenames_differ(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
nothing
Richèl J.C. Bilderbeek
Use check_beast2_options to check
the entire beast2_options
object
beast2_options
, which is a list,
has all the elements needed.Calls stop
if not.
check_beast2_options_names(beast2_options)
check_beast2_options_names(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
nothing
Richèl J.C. Bilderbeek
Use check_beast2_options to check
the entire beast2_options
object
beast2_options
is a valid BEAST2 options object.Calls stop
if the BEAST2 option object is invalid
check_beast2_optionses(beast2_optionses)
check_beast2_optionses(beast2_optionses)
beast2_optionses |
list of one or more |
Nothing.
Will stop
if the BEAST2 option object is invalid
Richèl J.C. Bilderbeek
Use create_beast2_options to create a valid BEAST2 options object
check_empty_beaustier_folders() check_beast2_optionses(list(create_beast2_options())) check_empty_beaustier_folders()
check_empty_beaustier_folders() check_beast2_optionses(list(create_beast2_options())) check_empty_beaustier_folders()
.jar
path.
Will stop if there is a problem with the BEAST2 .jar
path.Checks the BEAST2 .jar
path.
Will stop if there is a problem with the BEAST2 .jar
path.
check_beast2_path(beast2_path)
check_beast2_path(beast2_path)
beast2_path |
name of either a BEAST2 binary file
(usually simply |
nothing.
Will call stop
if the BEAST2 .jar
path has a problem
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed()) { beast2_path <- get_default_beast2_jar_path() check_beast2_path(beast2_path) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed()) { beast2_path <- get_default_beast2_jar_path() check_beast2_path(beast2_path) } check_empty_beaustier_folders()
Check if the folder for the state output file can be created. Will stop otherwise
check_can_create_dir_for_state_output_file(beast2_options)
check_can_create_dir_for_state_output_file(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Nothing. Will stop if the folder for the state output file cannot be created
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() check_can_create_dir_for_state_output_file( beast2_options = create_beast2_options() ) check_empty_beaustier_folders()
check_empty_beaustier_folders() check_can_create_dir_for_state_output_file( beast2_options = create_beast2_options() ) check_empty_beaustier_folders()
Check that a file can be created at a certain path.
check_can_create_file(filename, overwrite = TRUE)
check_can_create_file(filename, overwrite = TRUE)
filename |
file that may or may not be created |
overwrite |
if TRUE, if |
Will stop if not. Will stop if the file already exists. Does so by creating an empty file at the path, and then deleting it.
Nothing. Will stop if a file cannot be created at a certain path.
Richèl J.C. Bilderbeek
check_can_create_file("my_local_file.txt")
check_can_create_file("my_local_file.txt")
Check if the MCMC's screenlog file can be created. Will stop if not
check_can_create_screenlog_file(beast2_options)
check_can_create_screenlog_file(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Nothing. Will stop if the MCMC's screenlog file cannot be created.
Richèl J.C. Bilderbeek
Check if the state output file can be created. Will stop otherwise
check_can_create_state_output_file(beast2_options)
check_can_create_state_output_file(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Nothing. Will stop if the state output file cannot be created.
Richèl J.C. Bilderbeek
Check if the MCMC's tracelog file can be created. Will stop if not. If the tracelog file already exists, it is assumed that a new file can be created, by overwriting the existing one.
check_can_create_tracelog_file(beast2_options)
check_can_create_tracelog_file(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Nothing. Will stop if the MCMC's tracelog file is absent and cannot be created.
Richèl J.C. Bilderbeek
Check if the MCMC's treelog file can be created. Will stop if not
check_can_create_treelog_file(beast2_options)
check_can_create_treelog_file(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Nothing. Will stop if the MCMC's treelog file is absent and cannot be created.
Richèl J.C. Bilderbeek
Check there are no files in the default beastier folder. The goal is to make sure no temporary files are left undeleted. Will stop if there are files in the beastier folder
check_empty_beastier_folder(beastier_folder = get_beastier_folder())
check_empty_beastier_folder(beastier_folder = get_beastier_folder())
beastier_folder |
the path to the beastier temporary files folder |
Nothing. Will stop if there are files in the beastier folder
Richèl J.C. Bilderbeek
Check there are no files in the default 'beautier' and 'beastier' folders.
check_empty_beaustier_folders( beautier_folder = beautier::get_beautier_folder(), beastier_folder = get_beastier_folder() )
check_empty_beaustier_folders( beautier_folder = beautier::get_beautier_folder(), beastier_folder = get_beastier_folder() )
beautier_folder |
temporary folder used by beautier |
beastier_folder |
the path to the beastier temporary files folder |
The goal is to make sure no temporary files are left undeleted. Will stop if there are files in the beautier of beastier folder.
Nothing. Will stop if there are files in the beautier of beastier folder.
Richèl J.C. Bilderbeek
Checks the input filename. Will stop if there is a problem with the input filename.
check_input_filename(input_filename)
check_input_filename(input_filename)
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
Nothing. Will stop if the input file is invalid
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() check_input_filename( get_beastier_path("beast2_example_output.log") ) check_empty_beaustier_folders()
check_empty_beaustier_folders() check_input_filename( get_beastier_path("beast2_example_output.log") ) check_empty_beaustier_folders()
Checks the input filename. Will stop if there is a problem with the input filename.
check_input_filename_validity(beast2_options)
check_input_filename_validity(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
nothing. Will call stop
if the input file is invalid
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed()) { check_input_filename_validity( create_beast2_options( input_filename = get_beastier_path("2_4.xml") ) ) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed()) { check_input_filename_validity( create_beast2_options( input_filename = get_beastier_path("2_4.xml") ) ) } check_empty_beaustier_folders()
Will stop if not.
check_n_threads(n_threads)
check_n_threads(n_threads)
n_threads |
the number of computational threads to use. Use NA to use the BEAST2 default of 1. |
Nothing. Will stop if the number of threads in invalid
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() # Can have 1 or more threads check_n_threads(1) check_n_threads(2) # Can have NA threads check_n_threads(NA) check_empty_beaustier_folders()
check_empty_beaustier_folders() # Can have 1 or more threads check_n_threads(1) check_n_threads(2) # Can have NA threads check_n_threads(NA) check_empty_beaustier_folders()
Checks if the operating system is supported
check_os(os)
check_os(os)
os |
name of the operating system,
must be |
Nothing. Will stop if the OS is unsupported
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() check_os("mac") check_os("unix") check_os("win") check_empty_beaustier_folders()
check_empty_beaustier_folders() check_os("mac") check_os("unix") check_os("win") check_empty_beaustier_folders()
Will stop if not.
check_rng_seed(rng_seed)
check_rng_seed(rng_seed)
rng_seed |
the random number generator seed of the BEAST2 run.
Must be a non-zero positive integer value or NA.
If |
Nothing. Will stop if the RNG seed is invalid
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() # Numbers from 1 and higher are valid RNG seeds check_rng_seed(1) check_rng_seed(2) # Also NA is a valid RNG seed check_rng_seed(NA) check_empty_beaustier_folders()
check_empty_beaustier_folders() # Numbers from 1 and higher are valid RNG seeds check_rng_seed(1) check_rng_seed(2) # Also NA is a valid RNG seed check_rng_seed(NA) check_empty_beaustier_folders()
Continue a BEAST2 run
continue_beast2(beast2_options = create_beast2_options())
continue_beast2(beast2_options = create_beast2_options())
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
The text sent to STDOUT
and STDERR
.
It will create the file with name output_state_filenames
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { beast2_options <- create_beast2_options( input_filename = get_beastier_path("2_4.xml") ) run_beast2_from_options(beast2_options) continue_beast2(beast2_options) file.remove(beast2_options$output_state_filename) remove_beaustier_folders() } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { beast2_options <- create_beast2_options( input_filename = get_beastier_path("2_4.xml") ) run_beast2_from_options(beast2_options) continue_beast2(beast2_options) file.remove(beast2_options$output_state_filename) remove_beaustier_folders() } check_empty_beaustier_folders()
beast2_options
If the BEAST2 input .xml
filename
or the BEAST2 state .state.xml
filename
contain spaces, these filenames are quoted,
so that the command-line interface to BEAST2 correctly parses its arguments
create_beast2_continue_cmd_from_options(beast2_options)
create_beast2_continue_cmd_from_options(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
a character vector with the command and arguments to call BEAST2
Richèl J.C. Bilderbeek
if (is_beast2_installed()) { create_beast2_continue_cmd_from_options( beast2_options = create_beast2_options() ) }
if (is_beast2_installed()) { create_beast2_continue_cmd_from_options( beast2_options = create_beast2_options() ) }
Create the folder where the BEAST2 input file will be created
create_beast2_input_file_folder(beast2_options)
create_beast2_input_file_folder(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
nothing
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() beast2_options <- create_beast2_options() create_beast2_input_file_folder(beast2_options) remove_beaustier_folders() check_empty_beaustier_folders()
check_empty_beaustier_folders() beast2_options <- create_beast2_options() create_beast2_input_file_folder(beast2_options) remove_beaustier_folders() check_empty_beaustier_folders()
These BEAST2 options are the R equivalent of the command-line options.
create_beast2_options( input_filename = create_temp_input_filename(), output_state_filename = create_temp_state_filename(), rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = TRUE, beast2_path = get_default_beast2_path(), verbose = FALSE )
create_beast2_options( input_filename = create_temp_input_filename(), output_state_filename = create_temp_state_filename(), rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = TRUE, beast2_path = get_default_beast2_path(), verbose = FALSE )
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
output_state_filename |
name of the |
rng_seed |
the random number generator seed of the BEAST2 run.
Must be a non-zero positive integer value or NA.
If |
n_threads |
the number of computational threads to use. Use NA to use the BEAST2 default of 1. |
use_beagle |
use BEAGLE if present |
overwrite |
if TRUE: overwrite the
|
beast2_path |
name of either a BEAST2 binary file
(usually simply |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
a BEAST2 options structure, which is a list of all function arguments, of which all elements are checked (by check_beast2_options)
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() beast2_options <- create_beast2_options() check_beast2_options(beast2_options) check_empty_beaustier_folders()
check_empty_beaustier_folders() beast2_options <- create_beast2_options() check_beast2_options(beast2_options) check_empty_beaustier_folders()
Creates the terminal command to run BEAST2
create_beast2_run_cmd( input_filename, output_state_filename, rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = FALSE, beast2_path = get_default_beast2_path(), verbose = FALSE )
create_beast2_run_cmd( input_filename, output_state_filename, rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = FALSE, beast2_path = get_default_beast2_path(), verbose = FALSE )
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
output_state_filename |
name of the BEAST2 output file that
stores the state
(usually has a |
rng_seed |
the random number generator seed of the BEAST2 run.
Must be a non-zero positive integer value or NA.
If |
n_threads |
the number of computational threads to use. Use NA to use the BEAST2 default of 1. |
use_beagle |
use BEAGLE if present |
overwrite |
if TRUE: overwrite the
|
beast2_path |
name of either a BEAST2 binary file
(usually simply |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
a character vector with the command and arguments to call BEAST2
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed()) { create_beast2_run_cmd( input_filename = "input.xml", output_state_filename = "output.xml.state", beast2_path = get_default_beast2_jar_path() ) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed()) { create_beast2_run_cmd( input_filename = "input.xml", output_state_filename = "output.xml.state", beast2_path = get_default_beast2_jar_path() ) } check_empty_beaustier_folders()
beast2_options
Creates the terminal command to run BEAST2 from a beast2_options
create_beast2_run_cmd_from_options(beast2_options)
create_beast2_run_cmd_from_options(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
a character vector with the command and arguments to call BEAST2
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed()) { create_beast2_run_cmd_from_options( beast2_options = create_beast2_options() ) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed()) { create_beast2_run_cmd_from_options( beast2_options = create_beast2_options() ) } check_empty_beaustier_folders()
Create the folder for the BEAST2 screenlog file
create_beast2_screenlog_folder(beast2_options)
create_beast2_screenlog_folder(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Richèl J.C. Bilderbeek
Create the folder where the BEAST2 state output file will be created
create_beast2_state_output_file_folder(beast2_options)
create_beast2_state_output_file_folder(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
nothing
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() beast2_options <- create_beast2_options() create_beast2_state_output_file_folder(beast2_options) remove_beaustier_folders() check_empty_beaustier_folders()
check_empty_beaustier_folders() beast2_options <- create_beast2_options() create_beast2_state_output_file_folder(beast2_options) remove_beaustier_folders() check_empty_beaustier_folders()
Create the folder for the BEAST2 tracelog file
create_beast2_tracelog_folder(beast2_options)
create_beast2_tracelog_folder(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Richèl J.C. Bilderbeek
Create the folder for the BEAST2 treelog file
create_beast2_treelog_folder(beast2_options)
create_beast2_treelog_folder(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Richèl J.C. Bilderbeek
Creates the terminal command to validate a BEAST2 input file
create_beast2_validate_cmd( input_filename, beast2_path = get_default_beast2_path() )
create_beast2_validate_cmd( input_filename, beast2_path = get_default_beast2_path() )
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
beast2_path |
name of either a BEAST2 binary file
(usually simply |
a character vector, of which the first element
is the command (java
, in this case),
and the others are arguments (-jar
, in this case, followed
by more arguments.
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_validate_cmd( input_filename = "input.xml" ) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_validate_cmd( input_filename = "input.xml" ) } check_empty_beaustier_folders()
launcher.jar
fileCreates the terminal command to validate a BEAST2 input file
using a call to the launcher.jar
file
create_beast2_validate_cmd_bin( input_filename, beast2_bin_path = get_default_beast2_bin_path() )
create_beast2_validate_cmd_bin( input_filename, beast2_bin_path = get_default_beast2_bin_path() )
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
beast2_bin_path |
name of the BEAST2 binary file
(usually simply |
a character vector, of which the first element
is the command (java
, in this case),
and the others are arguments (-jar
, in this case, followed
by more arguments.
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_validate_cmd_bin( input_filename = "input.xml" ) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_validate_cmd_bin( input_filename = "input.xml" ) } check_empty_beaustier_folders()
launcher.jar
fileCreates the terminal command to validate a BEAST2 input file
using a call to the launcher.jar
file
create_beast2_validate_cmd_jar( input_filename, beast2_jar_path = get_default_beast2_jar_path() )
create_beast2_validate_cmd_jar( input_filename, beast2_jar_path = get_default_beast2_jar_path() )
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
beast2_jar_path |
name of the BEAST2 jar file
(usually has a |
a character vector, of which the first element
is the command (java
, in this case),
and the others are arguments (-jar
, in this case, followed
by more arguments.
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_validate_cmd_jar( input_filename = "input.xml" ) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_validate_cmd_jar( input_filename = "input.xml" ) } check_empty_beaustier_folders()
Creates the terminal command to version a BEAST2 input file
create_beast2_version_cmd(beast2_path = get_default_beast2_path())
create_beast2_version_cmd(beast2_path = get_default_beast2_path())
beast2_path |
name of either a BEAST2 binary file
(usually simply |
a character vector, of which the first element
is the command (java
, in this case),
and the others are arguments (-jar
, in this case, followed
by more arguments.
Richèl J.C. Bilderbeek
if (is_beast2_installed()) { create_beast2_version_cmd() }
if (is_beast2_installed()) { create_beast2_version_cmd() }
launcher.jar
fileCreates the terminal command to version a BEAST2 input file
using a call to the launcher.jar
file
create_beast2_version_cmd_bin(beast2_bin_path = get_default_beast2_bin_path())
create_beast2_version_cmd_bin(beast2_bin_path = get_default_beast2_bin_path())
beast2_bin_path |
name of the BEAST2 binary file
(usually simply |
a character vector, of which the first element
is the command (java
, in this case),
and the others are arguments (-jar
, in this case, followed
by more arguments.
Richèl J.C. Bilderbeek
if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_version_cmd_bin() }
if (is_beast2_installed() && beautier::is_on_ci()) { create_beast2_version_cmd_bin() }
launcher.jar
fileCreates the terminal command to version a BEAST2 input file
using a call to the launcher.jar
file
create_beast2_version_cmd_jar(beast2_jar_path = get_default_beast2_jar_path())
create_beast2_version_cmd_jar(beast2_jar_path = get_default_beast2_jar_path())
beast2_jar_path |
name of the BEAST2 jar file
(usually has a |
a character vector, of which the first element
is the command (java
, in this case),
and the others are arguments (-jar
, in this case, followed
by more arguments.
Richèl J.C. Bilderbeek
if (is_beast2_installed()) { create_beast2_version_cmd_jar() }
if (is_beast2_installed()) { create_beast2_version_cmd_jar() }
Create the temporary folder as used by beastier
create_beastier_tempfolder()
create_beastier_tempfolder()
nothing
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() create_beastier_tempfolder() remove_beaustier_folders() check_empty_beaustier_folders()
check_empty_beaustier_folders() create_beastier_tempfolder() remove_beaustier_folders() check_empty_beaustier_folders()
Create a 'beast2_options' structure to be used for the 'mcbette' R package, which is a package that allows one to do model comparison. The generated filenames indicating 'mcbette' usage, as well as the correct BEAST2 binary/executable type
create_mcbette_beast2_options( input_filename = create_temp_input_filename(), output_state_filename = create_temp_state_filename(), rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = TRUE, beast2_bin_path = get_default_beast2_bin_path(), verbose = FALSE )
create_mcbette_beast2_options( input_filename = create_temp_input_filename(), output_state_filename = create_temp_state_filename(), rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = TRUE, beast2_bin_path = get_default_beast2_bin_path(), verbose = FALSE )
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
output_state_filename |
name of the |
rng_seed |
the random number generator seed of the BEAST2 run.
Must be a non-zero positive integer value or NA.
If |
n_threads |
the number of computational threads to use. Use NA to use the BEAST2 default of 1. |
use_beagle |
use BEAGLE if present |
overwrite |
if TRUE: overwrite the
|
beast2_bin_path |
name of the BEAST2 binary file
(usually simply |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
a 'beast2_options' structure suitable to be used by the 'mcbette' R package, which is a list of all function arguments, of which all elements are checked (by check_beast2_options)
Richèl J.C. Bilderbeek
to create a regular (that is, not intended for model comparison) BEAST2 options structure, use create_beast2_options
check_empty_beaustier_folders() create_mcbette_beast2_options() check_empty_beaustier_folders()
check_empty_beaustier_folders() create_mcbette_beast2_options() check_empty_beaustier_folders()
Create a random alignment
create_random_alignment(n_taxa, sequence_length, rate = 1, taxa_name_ext = "")
create_random_alignment(n_taxa, sequence_length, rate = 1, taxa_name_ext = "")
n_taxa |
The number of taxa |
sequence_length |
The number of base pairs the alignment will have |
rate |
mutation rate |
taxa_name_ext |
the extension of the taxa names |
an alignment of class DNAbin
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() alignment <- create_random_alignment( n_taxa = 5, sequence_length = 10 ) image(alignment) remove_beaustier_folders() check_empty_beaustier_folders()
check_empty_beaustier_folders() alignment <- create_random_alignment( n_taxa = 5, sequence_length = 10 ) image(alignment) remove_beaustier_folders() check_empty_beaustier_folders()
Create a random FASTA file
create_random_fasta( n_taxa, sequence_length, fasta_filename, taxa_name_ext = "" )
create_random_fasta( n_taxa, sequence_length, fasta_filename, taxa_name_ext = "" )
n_taxa |
The number of taxa |
sequence_length |
a DNA sequence length, in base pairs |
fasta_filename |
a FASTA filename. |
taxa_name_ext |
the extension of the taxa names |
Nothing, creates a FASTA file
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() fasta_filename <- get_beastier_tempfilename() create_random_fasta( n_taxa = 5, sequence_length = 20, fasta_filename = fasta_filename ) file.remove(fasta_filename) remove_beaustier_folders() check_empty_beaustier_folders()
check_empty_beaustier_folders() fasta_filename <- get_beastier_tempfilename() create_random_fasta( n_taxa = 5, sequence_length = 20, fasta_filename = fasta_filename ) file.remove(fasta_filename) remove_beaustier_folders() check_empty_beaustier_folders()
Create a random phylogeny
create_random_phylogeny(n_taxa, taxa_name_ext = "")
create_random_phylogeny(n_taxa, taxa_name_ext = "")
n_taxa |
The number of taxa |
taxa_name_ext |
the extension of the taxa names |
a phylogeny of class 'phylo' (which is part of the 'ape' package)
Richèl J.C. Bilderbeek
create_random_phylogeny(n_taxa = 6)
create_random_phylogeny(n_taxa = 6)
Create a temporary filename for the BEAST2 XML filename
create_temp_input_filename()
create_temp_input_filename()
a temporary filename, that starts with 'beast2_' and has extension '.xml'
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() create_temp_input_filename() check_empty_beaustier_folders()
check_empty_beaustier_folders() create_temp_input_filename() check_empty_beaustier_folders()
Create a temporary file for the BEAST2 XML output file that stores its state.
create_temp_state_filename()
create_temp_state_filename()
a temporary filename, that starts with 'beast2_' and has extension '.xml.state'
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() create_temp_state_filename() check_empty_beaustier_folders()
check_empty_beaustier_folders() create_temp_state_filename() check_empty_beaustier_folders()
This function does nothing. It is intended to inherit is parameters' documentation.
default_params_doc( beast2_bin_path, beast2_folder, beast2_jar_path, beast2_options, beast2_optionses, beast2_path, beast2_version, beast2_working_dir, beastier_folder, beautier_folder, clock_model, clock_models, crown_age, crown_ages, fasta_filename, fasta_filenames, fixed_crown_age, fixed_crown_ages, initial_phylogenies, input_filename, mcmc, misc_options, n_taxa, n_threads, os, output_filename, output_log_filename, output_state_filename, output_trees_filenames, overwrite, rename_fun, rng_seed, sequence_length, site_model, site_models, tree_prior, tree_priors, use_beagle, verbose )
default_params_doc( beast2_bin_path, beast2_folder, beast2_jar_path, beast2_options, beast2_optionses, beast2_path, beast2_version, beast2_working_dir, beastier_folder, beautier_folder, clock_model, clock_models, crown_age, crown_ages, fasta_filename, fasta_filenames, fixed_crown_age, fixed_crown_ages, initial_phylogenies, input_filename, mcmc, misc_options, n_taxa, n_threads, os, output_filename, output_log_filename, output_state_filename, output_trees_filenames, overwrite, rename_fun, rng_seed, sequence_length, site_model, site_models, tree_prior, tree_priors, use_beagle, verbose )
beast2_bin_path |
name of the BEAST2 binary file
(usually simply |
beast2_folder |
the folder where the BEAST2 is installed. Note that this is not the folder where the BEAST2 executable is installed: the BEAST2 executable is in a subfolder. Use get_default_beast2_folder to get the default BEAST2 folder. Use get_default_beast2_bin_path to get the full path to the default BEAST2 executable. |
beast2_jar_path |
name of the BEAST2 jar file
(usually has a |
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
beast2_optionses |
list of one or more |
beast2_path |
name of either a BEAST2 binary file
(usually simply |
beast2_version |
the version of BEAST2. By default, this is the version as returned by get_default_beast2_version |
beast2_working_dir |
a folder where BEAST2 can work in isolation. For each BEAST2 run, a new subfolder is created in that folder. Within this folder, BEAST2 is allowed to create all of its output files, without the risk of overwriting existing ones, allowing BEAST2 to run in multiple parallel processes. |
beastier_folder |
the path to the beastier temporary files folder |
beautier_folder |
temporary folder used by beautier |
clock_model |
a |
clock_models |
a list of one or more |
crown_age |
the crown age of the phylogeny |
crown_ages |
the crown ages of the phylogenies. Set to NA if the crown age needs to be estimated |
fasta_filename |
a FASTA filename. |
fasta_filenames |
One or more FASTA filenames. |
fixed_crown_age |
determines if the phylogeny's crown age is fixed. If FALSE, crown age is estimated by BEAST2. If TRUE, the crown age is fixed to the crown age of the initial phylogeny. |
fixed_crown_ages |
one or more booleans to determine if the phylogenies' crown ages are fixed. If FALSE, crown age is estimated by BEAST2. If TRUE, the crown age is fixed to the crown age of the initial phylogeny. |
initial_phylogenies |
one or more MCMC chain's initial phylogenies.
Each one set to NA will result in BEAST2 using a random phylogeny. Else
the phylogeny is assumed to be of class |
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
mcmc |
one |
misc_options |
one |
n_taxa |
The number of taxa |
n_threads |
the number of computational threads to use. Use NA to use the BEAST2 default of 1. |
os |
name of the operating system,
must be |
output_filename |
Name of the XML parameter file created by this function. BEAST2 uses this file as input. |
output_log_filename |
name of the .log file to create |
output_state_filename |
name of the |
output_trees_filenames |
one or more names for .trees file to create. There will be one .trees file created per alignment in the input file. The number of alignments must equal the number of .trees filenames, else an error is thrown. Alignments are sorted alphabetically by their IDs |
overwrite |
if TRUE: overwrite the
|
rename_fun |
a function to rename a filename, as can be checked by check_rename_fun. This function should have one argument, which will be a filename or NA. The function should return one filename (when passed one filename) or one NA (when passed one NA). Example rename functions are:
|
rng_seed |
the random number generator seed of the BEAST2 run.
Must be a non-zero positive integer value or NA.
If |
sequence_length |
a DNA sequence length, in base pairs |
site_model |
a |
site_models |
one or more |
tree_prior |
a |
tree_priors |
one or more |
use_beagle |
use BEAGLE if present |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
Nothing. This is an internal function that does nothing
This is an internal function, so it should be marked with
@noRd
. This is not done, as this will disallow all
functions to find the documentation parameters
Richèl J.C. Bilderbeek
To achieve this, run_beast2_from_options is called.
do_minimal_run()
do_minimal_run()
The text sent to STDOUT
and STDERR
.
It will create the files with name output_state_filename
Richèl J.C. Bilderbeek
if (is_beast2_installed() && beautier::is_on_ci()) { do_minimal_run() }
if (is_beast2_installed() && beautier::is_on_ci()) { do_minimal_run() }
Extract the screenlog filename from a BEAST2 input file
extract_screenlog_filename_from_beast2_input_file(input_filename)
extract_screenlog_filename_from_beast2_input_file(input_filename)
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
the screenlog filename for a BEAST2 input file
Richèl J.C. Bilderbeek
Extract the tracelog filename for a BEAST2 input file
extract_tracelog_filename_from_beast2_input_file(input_filename)
extract_tracelog_filename_from_beast2_input_file(input_filename)
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
the name of the tracelog file
Richèl J.C. Bilderbeek
if (beautier::is_on_ci()) { beast2_input_filename <- get_beastier_tempfilename() tracelog_filename <- get_beastier_tempfilename() beautier::create_beast2_input_file_from_model( input_filename = beautier::get_beautier_path("test_output_0.fas"), output_filename = beast2_input_filename, inference_model = beautier::create_inference_model( mcmc = beautier::create_mcmc( tracelog = beautier::create_tracelog( filename = tracelog_filename ) ) ) ) extract_tracelog_filename_from_beast2_input_file( input_filename = beast2_input_filename ) file.remove(beast2_input_filename) remove_beaustier_folders() }
if (beautier::is_on_ci()) { beast2_input_filename <- get_beastier_tempfilename() tracelog_filename <- get_beastier_tempfilename() beautier::create_beast2_input_file_from_model( input_filename = beautier::get_beautier_path("test_output_0.fas"), output_filename = beast2_input_filename, inference_model = beautier::create_inference_model( mcmc = beautier::create_mcmc( tracelog = beautier::create_tracelog( filename = tracelog_filename ) ) ) ) extract_tracelog_filename_from_beast2_input_file( input_filename = beast2_input_filename ) file.remove(beast2_input_filename) remove_beaustier_folders() }
Extract the treelog filename from a BEAST2 input file
extract_treelog_filename_from_beast2_input_file(input_filename)
extract_treelog_filename_from_beast2_input_file(input_filename)
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
the treelog filename for a BEAST2 input file
Richèl J.C. Bilderbeek
if (beautier::is_on_ci()) { beast2_input_filename <- get_beastier_tempfilename() beautier::create_beast2_input_file_from_model( input_filename = beautier::get_beautier_path("test_output_0.fas"), output_filename = beast2_input_filename ) extract_treelog_filename_from_beast2_input_file( input_filename = beast2_input_filename ) file.remove(beast2_input_filename) remove_beaustier_folders() }
if (beautier::is_on_ci()) { beast2_input_filename <- get_beastier_tempfilename() beautier::create_beast2_input_file_from_model( input_filename = beautier::get_beautier_path("test_output_0.fas"), output_filename = beast2_input_filename ) extract_treelog_filename_from_beast2_input_file( input_filename = beast2_input_filename ) file.remove(beast2_input_filename) remove_beaustier_folders() }
Get the alignment ID from a file with one alignment
get_alignment_ids_from_xml_filename(xml_filename)
get_alignment_ids_from_xml_filename(xml_filename)
xml_filename |
name of a BEAST2 XML input filename |
one or more alignment IDs
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() # test_output_0 get_alignment_ids_from_xml_filename(get_beastier_path("2_4.xml")) # c("anthus_aco","anthus_nd2") get_alignment_ids_from_xml_filename(get_beastier_path("anthus_15_15.xml")) check_empty_beaustier_folders()
check_empty_beaustier_folders() # test_output_0 get_alignment_ids_from_xml_filename(get_beastier_path("2_4.xml")) # c("anthus_aco","anthus_nd2") get_alignment_ids_from_xml_filename(get_beastier_path("anthus_15_15.xml")) check_empty_beaustier_folders()
Will stop if the filename is not a BEAST2 example file
get_beast2_example_filename( filename, beast2_folder = get_default_beast2_folder() )
get_beast2_example_filename( filename, beast2_folder = get_default_beast2_folder() )
filename |
name of the BEAST2 example file. This should exclude the full path; this function exists to add that full path |
beast2_folder |
the folder where the BEAST2 is installed. Note that this is not the folder where the BEAST2 executable is installed: the BEAST2 executable is in a subfolder. Use get_default_beast2_folder to get the default BEAST2 folder. Use get_default_beast2_bin_path to get the full path to the default BEAST2 executable. |
the full path of a BEAST2 example file, will stop if the filename is not a BEAST2 example file
if (is_beast2_installed()) { get_beast2_example_filename("testJukesCantor.xml") }
if (is_beast2_installed()) { get_beast2_example_filename("testJukesCantor.xml") }
Get a list with the full paths of all BEAST2 example filenames
get_beast2_example_filenames(beast2_folder = get_default_beast2_folder())
get_beast2_example_filenames(beast2_folder = get_default_beast2_folder())
beast2_folder |
the folder where the BEAST2 is installed. Note that this is not the folder where the BEAST2 executable is installed: the BEAST2 executable is in a subfolder. Use get_default_beast2_folder to get the default BEAST2 folder. Use get_default_beast2_bin_path to get the full path to the default BEAST2 executable. |
a list with the full paths of all BEAST2 example filenames
Richèl J.C. Bilderbeek
if (is_beast2_installed()) { get_beast2_example_filenames() }
if (is_beast2_installed()) { get_beast2_example_filenames() }
One way to fix the error
no main manifest attribute
is to specify the main class name.
get_beast2_main_class_name()
get_beast2_main_class_name()
the BEAST2 main class name
Richèl J.C. Bilderbeek
get_beast2_main_class_name()
get_beast2_main_class_name()
Extract the filenames from a 'beast2_options'
get_beast2_options_filenames(beast2_options)
get_beast2_options_filenames(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
the filenames from a 'beast2_options'
Richèl J.C. Bilderbeek
beast2_options <- create_beast2_options() get_beast2_options_filenames(beast2_options)
beast2_options <- create_beast2_options() get_beast2_options_filenames(beast2_options)
Get the BEAST2 version
get_beast2_version(beast2_path = get_default_beast2_path())
get_beast2_version(beast2_path = get_default_beast2_path())
beast2_path |
name of either a BEAST2 binary file
(usually simply |
the BEAST2 version
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { get_beast2_version() } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { get_beast2_version() } check_empty_beaustier_folders()
Get the path to the beastier temporary files folder.
get_beastier_folder()
get_beastier_folder()
the path to the beastier temporary files folder.
Richèl J.C. Bilderbeek
get_beastier_folder()
get_beastier_folder()
inst/extdata
folderGet the full path of a file in the inst/extdata
folder
get_beastier_path(filename)
get_beastier_path(filename)
filename |
the file's name, without the path |
the full path to the filename. Will stop
if the file
is absent in the inst/extdata
folder
Richèl J.C. Bilderbeek
for more files, use get_beastier_paths
get_beastier_path("beast2_example_output.log") get_beastier_path("beast2_example_output.trees") get_beastier_path("beast2_example_output.xml") get_beastier_path("beast2_example_output.xml.state")
get_beastier_path("beast2_example_output.log") get_beastier_path("beast2_example_output.trees") get_beastier_path("beast2_example_output.xml") get_beastier_path("beast2_example_output.xml.state")
inst/extdata
folderGet the full paths of files in the inst/extdata
folder
get_beastier_paths(filenames)
get_beastier_paths(filenames)
filenames |
the files' names, without the path |
the filenames' full paths. Will stop
if a file
is absent in the inst/extdata
folder
Richèl J.C. Bilderbeek
for one file, use get_beastier_path
get_beastier_paths( c( "beast2_example_output.log", "beast2_example_output.trees", "beast2_example_output.xml", "beast2_example_output.xml.state" ) )
get_beastier_paths( c( "beast2_example_output.log", "beast2_example_output.trees", "beast2_example_output.xml", "beast2_example_output.xml.state" ) )
Get a temporary filename, similar to tempfile, except that it always writes to a temporary folder named beastier.
get_beastier_tempfilename(pattern = "file", fileext = "")
get_beastier_tempfilename(pattern = "file", fileext = "")
pattern |
a non-empty character vector giving the initial part of the name. |
fileext |
a non-empty character vector giving the file extension |
name for a temporary file
this function is added to make sure no temporary cache files are left undeleted
Richèl J.C. Bilderbeek
get_beastier_tempfilename() get_beastier_tempfilename(pattern = "my_pattern_") get_beastier_tempfilename(fileext = ".ext")
get_beastier_tempfilename() get_beastier_tempfilename(pattern = "my_pattern_") get_beastier_tempfilename(fileext = ".ext")
beast
, that is) pathGet the default BEAST2 binary file (beast
, that is) path
get_default_beast2_bin_path( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
get_default_beast2_bin_path( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
beast2_folder |
the folder where the BEAST2 is installed. Note that this is not the folder where the BEAST2 executable is installed: the BEAST2 executable is in a subfolder. Use get_default_beast2_folder to get the default BEAST2 folder. Use get_default_beast2_bin_path to get the full path to the default BEAST2 executable. |
os |
name of the operating system,
must be |
the default BEAST2 binary file's path
Richèl J.C. Bilderbeek
Use get_default_beast2_folder to get the default folder in which BEAST2 is installed. Use install_beast2 with default arguments to install BEAST2 to this location.
check_empty_beaustier_folders() if (is_beast2_installed()) { get_default_beast2_bin_path() } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed()) { get_default_beast2_bin_path() } check_empty_beaustier_folders()
Get the default BEAST2 download URL, which depends on the operating system
get_default_beast2_download_url( beast2_version = get_default_beast2_version(), os = rappdirs::app_dir()$os )
get_default_beast2_download_url( beast2_version = get_default_beast2_version(), os = rappdirs::app_dir()$os )
beast2_version |
the version of BEAST2. By default, this is the version as returned by get_default_beast2_version |
os |
name of the operating system,
must be |
the URL where BEAST2 can be downloaded from
Richèl J.C. Bilderbeek
get_default_beast2_download_url()
get_default_beast2_download_url()
Get the BEAST2 download URL for Linux
get_default_beast2_download_url_linux( beast2_version = get_default_beast2_version() )
get_default_beast2_download_url_linux( beast2_version = get_default_beast2_version() )
beast2_version |
the version of BEAST2. By default, this is the version as returned by get_default_beast2_version |
the URL where BEAST2 can be downloaded from
Richèl J.C. Bilderbeek
Get the BEAST2 download URL for Windows
get_default_beast2_download_url_win( beast2_version = get_default_beast2_version() )
get_default_beast2_download_url_win( beast2_version = get_default_beast2_version() )
beast2_version |
the version of BEAST2. By default, this is the version as returned by get_default_beast2_version |
the URL where BEAST2 can be downloaded from
Richèl J.C. Bilderbeek
Get the path to the folder where this package installs BEAST2 by default
get_default_beast2_folder()
get_default_beast2_folder()
the path to the folder where this package installs BEAST2 by default
Richèl J.C. Bilderbeek
Use get_default_beast2_jar_path to get the path to the BEAST2 jar file, when installed by this package Use install_beast2 with default arguments to install BEAST2 to this folder.
check_empty_beaustier_folders() get_default_beast2_folder() check_empty_beaustier_folders()
check_empty_beaustier_folders() get_default_beast2_folder() check_empty_beaustier_folders()
Get the default BEAST2 jar file's path
get_default_beast2_jar_path( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
get_default_beast2_jar_path( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
beast2_folder |
the folder where the BEAST2 is installed. Note that this is not the folder where the BEAST2 executable is installed: the BEAST2 executable is in a subfolder. Use get_default_beast2_folder to get the default BEAST2 folder. Use get_default_beast2_bin_path to get the full path to the default BEAST2 executable. |
os |
name of the operating system,
must be |
the default BEAST2 jar file's path
Richèl J.C. Bilderbeek
Use get_default_beast2_folder to get the default folder in which BEAST2 is installed. Use install_beast2 with default arguments to install BEAST2 to this location.
check_empty_beaustier_folders() get_default_beast2_jar_path() check_empty_beaustier_folders()
check_empty_beaustier_folders() get_default_beast2_jar_path() check_empty_beaustier_folders()
Get the default BEAST2 path
get_default_beast2_path( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
get_default_beast2_path( beast2_folder = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
beast2_folder |
the folder where the BEAST2 is installed. Note that this is not the folder where the BEAST2 executable is installed: the BEAST2 executable is in a subfolder. Use get_default_beast2_folder to get the default BEAST2 folder. Use get_default_beast2_bin_path to get the full path to the default BEAST2 executable. |
os |
name of the operating system,
must be |
the default BEAST2 path
Richèl J.C. Bilderbeek
Use get_default_beast2_bin_path to get the default path to the BEAST2 binary file. Use get_default_beast2_jar_path to get the default path to the BEAST2 jar file. Use get_default_beast2_folder to get the default folder in which BEAST2 is installed. Use install_beast2 with default arguments to install BEAST2 to this location.
if (is_beast2_installed()) { get_default_beast2_path() }
if (is_beast2_installed()) { get_default_beast2_path() }
Get the default BEAST2 version that is used by beastier
get_default_beast2_version()
get_default_beast2_version()
the BEAST2 version
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() get_default_beast2_version() check_empty_beaustier_folders()
check_empty_beaustier_folders() get_default_beast2_version() check_empty_beaustier_folders()
Obtains the default path to the Java executable
get_default_java_path(os = rappdirs::app_dir()$os)
get_default_java_path(os = rappdirs::app_dir()$os)
os |
name of the operating system,
must be |
the default path to the Java executable
Richèl J.C. Bilderbeek
RealParameter
IDsFind duplicate RealParameter
IDs
get_duplicate_param_ids(text)
get_duplicate_param_ids(text)
text |
the XML as text |
a vector of duplicate IDs, will be empty if all IDs are unique
Richèl J.C. Bilderbeek
to see if all IDs are unique, use has_unique_ids
check_empty_beaustier_folders() line_1 <- "<parameter id=\"RealParameter.1\" ...</parameter>" line_2 <- "<parameter id=\"RealParameter.2\" ...</parameter>" # No elements get_duplicate_param_ids(c(line_1, line_2)) # 'RealParameter.1' get_duplicate_param_ids(c(line_1, line_1)) # 'RealParameter.2' get_duplicate_param_ids(c(line_2, line_2)) check_empty_beaustier_folders()
check_empty_beaustier_folders() line_1 <- "<parameter id=\"RealParameter.1\" ...</parameter>" line_2 <- "<parameter id=\"RealParameter.2\" ...</parameter>" # No elements get_duplicate_param_ids(c(line_1, line_2)) # 'RealParameter.1' get_duplicate_param_ids(c(line_1, line_1)) # 'RealParameter.2' get_duplicate_param_ids(c(line_2, line_2)) check_empty_beaustier_folders()
Get the Java version
get_java_version()
get_java_version()
the Java version
Richèl J.C. Bilderbeek
if (is_beast2_installed() && beautier::is_on_ci()) { get_java_version() }
if (is_beast2_installed() && beautier::is_on_ci()) { get_java_version() }
Get the .trees filenames that BEAST2 will produce
get_trees_filenames(input_filename)
get_trees_filenames(input_filename)
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
character vector with the names of the .trees files that BEAST2 will produce
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() get_trees_filenames(get_beastier_path("2_4.xml")) get_trees_filenames(get_beastier_path("anthus_2_4.xml")) check_empty_beaustier_folders()
check_empty_beaustier_folders() get_trees_filenames(get_beastier_path("2_4.xml")) get_trees_filenames(get_beastier_path("anthus_2_4.xml")) check_empty_beaustier_folders()
Determines if BEAST2 issues a warning when using the BEAST2 XML input file
gives_beast2_warning( filename, verbose = FALSE, beast2_path = get_default_beast2_path() )
gives_beast2_warning( filename, verbose = FALSE, beast2_path = get_default_beast2_path() )
filename |
name of the BEAST2 XML input file |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
beast2_path |
name of either a BEAST2 binary file
(usually simply |
TRUE if the file produces a BEAST2 warning, FALSE if not
Richèl J.C. Bilderbeek
Use is_beast2_input_file
to check if a file is a
valid BEAST2 input file.
Use are_beast2_input_lines
to check if the text (for
example, as loaded from a file) to be valid BEAST2 input.
if (is_beast2_installed() && beautier::is_on_ci() && rappdirs::app_dir()$os == "unix") { # This file is OK for BEAST2, no warning, returns FALSE gives_beast2_warning(filename = get_beastier_path("2_4.xml")) # BEAST2 will give a warning on this file, returns TRUE gives_beast2_warning( filename = get_beastier_path("beast2_warning.xml") ) }
if (is_beast2_installed() && beautier::is_on_ci() && rappdirs::app_dir()$os == "unix") { # This file is OK for BEAST2, no warning, returns FALSE gives_beast2_warning(filename = get_beastier_path("2_4.xml")) # BEAST2 will give a warning on this file, returns TRUE gives_beast2_warning( filename = get_beastier_path("beast2_warning.xml") ) }
Determine if the XML text has unique parameter IDs
has_unique_ids(text)
has_unique_ids(text)
text |
the XML as text |
TRUE if all parameter IDs are unique, FALSE otherwise
Richèl J.C. Bilderbeek
to obtain the duplicate parameter IDs, use
get_duplicate_param_ids
check_empty_beaustier_folders() line_1 <- "<parameter id=\"RealParameter.1\" ...</parameter>" line_2 <- "<parameter id=\"RealParameter.2\" ...</parameter>" # Unique IDs has_unique_ids(c(line_1, line_2)) # No unique ID has_unique_ids(c(line_1, line_1)) check_empty_beaustier_folders()
check_empty_beaustier_folders() line_1 <- "<parameter id=\"RealParameter.1\" ...</parameter>" line_2 <- "<parameter id=\"RealParameter.2\" ...</parameter>" # Unique IDs has_unique_ids(c(line_1, line_2)) # No unique ID has_unique_ids(c(line_1, line_1)) check_empty_beaustier_folders()
This function is deprecated as it violated CRAN policy.
install_beast2( folder_name = rappdirs::user_data_dir(), beast2_version = beastier::get_default_beast2_version(), verbose = FALSE, os = rappdirs::app_dir()$os )
install_beast2( folder_name = rappdirs::user_data_dir(), beast2_version = beastier::get_default_beast2_version(), verbose = FALSE, os = rappdirs::app_dir()$os )
folder_name |
name of the folder where the BEAST2 files will
be put.
The name of the BEAST2 binary file will be at
|
beast2_version |
the version of BEAST2. By default, this is the version as returned by get_default_beast2_version |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
os |
name of the operating system,
must be |
To install BEAST2 from R, go to https://github.com/richelbilderbeek/beastierinstall.
Nothing. Gives a deprecation message using stop.
Richèl J.C. Bilderbeek
Determines if the input is an alignment of type DNAbin
is_alignment(input)
is_alignment(input)
input |
The input to be tested |
TRUE or FALSE
Richèl J.C. Bilderbeek
Is a file a valid BEAST2 input file?
is_beast2_input_file( filename, show_warnings = FALSE, verbose = FALSE, beast2_path = get_default_beast2_path() )
is_beast2_input_file( filename, show_warnings = FALSE, verbose = FALSE, beast2_path = get_default_beast2_path() )
filename |
name of the BEAST2 XML input file |
show_warnings |
if TRUE, warnings will shown |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
beast2_path |
name of either a BEAST2 binary file
(usually simply |
TRUE if the file is valid, FALSE if not
this function only works on standard BEAST2 input files: if a BEAST2 input file is modified to use a certain BEAST2 package, this function will label it as an invalid file
Richèl J.C. Bilderbeek
Use are_beast2_input_lines
to check the lines
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { filename <- get_beastier_path("anthus_2_4.xml") # TRUE, this is a BEAST2 input file is_beast2_input_file(filename) filename <- get_beastier_path("beast2_example_output.log") # FALSE, this is not a BEAST2 input file, # it is a BEAST2 output log file insteaf is_beast2_input_file(filename) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { filename <- get_beastier_path("anthus_2_4.xml") # TRUE, this is a BEAST2 input file is_beast2_input_file(filename) filename <- get_beastier_path("beast2_example_output.log") # FALSE, this is not a BEAST2 input file, # it is a BEAST2 output log file insteaf is_beast2_input_file(filename) } check_empty_beaustier_folders()
Checks if BEAST2 is installed
is_beast2_installed( folder_name = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
is_beast2_installed( folder_name = get_default_beast2_folder(), os = rappdirs::app_dir()$os )
folder_name |
name of the folder where the BEAST2 files are put.
The name of the BEAST2 binary file will be at
|
os |
name of the operating system,
must be |
TRUE if BEAST2 is installed
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() is_beast2_installed() check_empty_beaustier_folders()
check_empty_beaustier_folders() is_beast2_installed() check_empty_beaustier_folders()
Is the path a path to the BEAST2 binary file? Does not check if the file at that path is present
is_bin_path(path)
is_bin_path(path)
path |
a string to a path |
TRUE if the path is a path to a BEAST2 binary file
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed()) { # TRUE is_bin_path("beast") is_bin_path("BEAST.exe") is_bin_path(get_default_beast2_bin_path()) # FALSE is_bin_path("launcher.jar") is_bin_path(get_default_beast2_jar_path()) } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed()) { # TRUE is_bin_path("beast") is_bin_path("BEAST.exe") is_bin_path(get_default_beast2_bin_path()) # FALSE is_bin_path("launcher.jar") is_bin_path(get_default_beast2_jar_path()) } check_empty_beaustier_folders()
Is the path a path to the BEAST2 jar file? Does not check if the file at that path is present
is_jar_path(path)
is_jar_path(path)
path |
a string to a path |
TRUE if the path is a path to a BEAST2 jar file
Richèl J.C. Bilderbeek
# Returns TRUE is_jar_path("beast.jar") is_jar_path("launcher.jar") is_jar_path(get_default_beast2_jar_path()) # Returns FALSE is_jar_path("beast") is_jar_path(get_default_beast2_bin_path())
# Returns TRUE is_jar_path("beast.jar") is_jar_path("launcher.jar") is_jar_path(get_default_beast2_jar_path()) # Returns FALSE is_jar_path("beast") is_jar_path(get_default_beast2_bin_path())
Deprecated function, use is_on_appveyor
is_on_appveyor()
is_on_appveyor()
TRUE if run on AppVeyor, FALSE otherwise
Richèl J.C. Bilderbeek
Deprecated function, use is_on_ci
is_on_ci()
is_on_ci()
TRUE if run on AppVeyor or Travis CI, FALSE otherwise
Richèl J.C. Bilderbeek
Deprecated function, use is_on_travis
is_on_travis()
is_on_travis()
TRUE if run on Travis CI, FALSE otherwise
Richèl J.C. Bilderbeek
Is the path a path to the BEAST2 binary file? Does not check if the file at that path is present
is_win_bin_path(path)
is_win_bin_path(path)
path |
a string to a path |
TRUE if the path is a path to a BEAST2 binary file
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() # TRUE is_win_bin_path("BEAST.exe") # FALSE is_win_bin_path("beast") is_win_bin_path("launcher.jar") check_empty_beaustier_folders()
check_empty_beaustier_folders() # TRUE is_win_bin_path("BEAST.exe") # FALSE is_win_bin_path("beast") is_win_bin_path("launcher.jar") check_empty_beaustier_folders()
Pretty-print a 'beast2_options'
print_beast2_options(beast2_options)
print_beast2_options(beast2_options)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
Nothing. Will display the 'beast2_options' using cat.
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() print_beast2_options(create_beast2_options()) check_empty_beaustier_folders()
check_empty_beaustier_folders() print_beast2_options(create_beast2_options()) check_empty_beaustier_folders()
Check there are no files in the default beautier folder. The goal is to make sure no temporary files are left undeleted. Will stop if there are files in the beautier folder.
remove_beastier_folder()
remove_beastier_folder()
Nothing.
Richèl J.C. Bilderbeek
use remove_beautier_folder to remove the default 'beautier' folder
check_empty_beastier_folder() remove_beastier_folder() check_empty_beastier_folder()
check_empty_beastier_folder() remove_beastier_folder() check_empty_beastier_folder()
Remove the 'beautier' and 'beastier' temporary folders
remove_beaustier_folders()
remove_beaustier_folders()
Nothing.
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() remove_beaustier_folders() check_empty_beaustier_folders()
check_empty_beaustier_folders() remove_beaustier_folders() check_empty_beaustier_folders()
Remove a file if it is present, will do nothing if it is not.
remove_file_if_present(filename)
remove_file_if_present(filename)
filename |
name of a file |
Nothing. Will remove the file if it is presented, will do nothing if it is not.
Richèl J.C. Bilderbeek
filename <- tempfile() file.create(filename) remove_file_if_present(filename) remove_file_if_present(filename)
filename <- tempfile() file.create(filename) remove_file_if_present(filename) remove_file_if_present(filename)
Rename the filenames in the BEAST2 options
rename_beast2_options_filenames(beast2_options, rename_fun)
rename_beast2_options_filenames(beast2_options, rename_fun)
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
rename_fun |
a function to rename a filename, as can be checked by check_rename_fun. This function should have one argument, which will be a filename or NA. The function should return one filename (when passed one filename) or one NA (when passed one NA). Example rename functions are:
|
a 'beast2_options' with the filenames it contains renamed
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() # beast2_options with local filenames beast2_options <- create_beast2_options( input_filename = "my.fas", output_state_filename = "my_state.xml.state" ) # Rename filenames to be in /my/new/folder rename_beast2_options_filenames( beast2_options = beast2_options, rename_fun = beautier::get_replace_dir_fun("/my/new/folder") ) check_empty_beaustier_folders()
check_empty_beaustier_folders() # beast2_options with local filenames beast2_options <- create_beast2_options( input_filename = "my.fas", output_state_filename = "my_state.xml.state" ) # Rename filenames to be in /my/new/folder rename_beast2_options_filenames( beast2_options = beast2_options, rename_fun = beautier::get_replace_dir_fun("/my/new/folder") ) check_empty_beaustier_folders()
Run BEAST2
run_beast2( input_filename, output_state_filename = create_temp_state_filename(), rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = TRUE, beast2_path = get_default_beast2_path(), verbose = FALSE )
run_beast2( input_filename, output_state_filename = create_temp_state_filename(), rng_seed = NA, n_threads = NA, use_beagle = FALSE, overwrite = TRUE, beast2_path = get_default_beast2_path(), verbose = FALSE )
input_filename |
the name of a BEAST2 input XML file.
This file usually has an |
output_state_filename |
name of the |
rng_seed |
the random number generator seed of the BEAST2 run.
Must be a non-zero positive integer value or NA.
If |
n_threads |
the number of computational threads to use. Use NA to use the BEAST2 default of 1. |
use_beagle |
use BEAGLE if present |
overwrite |
if TRUE: overwrite the
|
beast2_path |
name of either a BEAST2 binary file
(usually simply |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
The text sent to STDOUT
and STDERR
.
It will create the file with name output_state_filenames
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { output_state_filename <- create_temp_state_filename() run_beast2( input_filename = get_beastier_path("2_4.xml"), output_state_filename = output_state_filename ) file.remove(output_state_filename) remove_beaustier_folders() } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { output_state_filename <- create_temp_state_filename() run_beast2( input_filename = get_beastier_path("2_4.xml"), output_state_filename = output_state_filename ) file.remove(output_state_filename) remove_beaustier_folders() } check_empty_beaustier_folders()
Run BEAST2
run_beast2_from_options(beast2_options = create_beast2_options())
run_beast2_from_options(beast2_options = create_beast2_options())
beast2_options |
a set of BEAST2 options, that are the R equivalent of the BEAST2 command-line options, as can be created by create_beast2_options |
The text sent to STDOUT
and STDERR
.
It will create the file with name output_state_filenames
Richèl J.C. Bilderbeek
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { beast2_options <- create_beast2_options( input_filename = get_beastier_path("2_4.xml") ) run_beast2_from_options(beast2_options) file.remove(beast2_options$output_state_filename) remove_beaustier_folders() } check_empty_beaustier_folders()
check_empty_beaustier_folders() if (is_beast2_installed() && beautier::is_on_ci()) { beast2_options <- create_beast2_options( input_filename = get_beastier_path("2_4.xml") ) run_beast2_from_options(beast2_options) file.remove(beast2_options$output_state_filename) remove_beaustier_folders() } check_empty_beaustier_folders()
Save text (a container of strings) to a file
save_lines(filename, lines)
save_lines(filename, lines)
filename |
filename of the file to have the text written to |
lines |
lines of text to be written to file |
Nothing. Will save the lines to file
Richèl J.C. Bilderbeek
text <- c("hello", "world") filename <- get_beastier_tempfilename() save_lines(filename = filename, lines = text) file.remove(filename) remove_beaustier_folders()
text <- c("hello", "world") filename <- get_beastier_tempfilename() save_lines(filename = filename, lines = text) file.remove(filename) remove_beaustier_folders()
Save a NEXUS file as a FASTA file
save_nexus_as_fasta(nexus_filename, fasta_filename)
save_nexus_as_fasta(nexus_filename, fasta_filename)
nexus_filename |
name of an existing NEXUS file |
fasta_filename |
name of the FASTA file to be created |
nothing. The NEXUS file will be saved as a FASTA file
Deprecated function to uninstall BEAST2
uninstall_beast2( folder_name = rappdirs::user_data_dir(), os = rappdirs::app_dir()$os, verbose = FALSE )
uninstall_beast2( folder_name = rappdirs::user_data_dir(), os = rappdirs::app_dir()$os, verbose = FALSE )
folder_name |
name of the folder where the BEAST2 files are installed.
The name of the BEAST2 binary file will be at
|
os |
name of the operating system,
must be |
verbose |
if TRUE, additional information is displayed, that is potentially useful in debugging |
Nothing. A deprecation message using stop will be triggered
Richèl J.C. Bilderbeek
Deprecated function to upgrade BEAST2.
upgrade_beast2( folder_name = rappdirs::user_data_dir(), os = rappdirs::app_dir()$os )
upgrade_beast2( folder_name = rappdirs::user_data_dir(), os = rappdirs::app_dir()$os )
folder_name |
name of the folder where the BEAST2 files will
be put.
The name of the BEAST2 binary file will be at
|
os |
name of the operating system,
must be |
Nothing. A deprecation message using stop will be triggered
Richèl J.C. Bilderbeek