View source: R/sim_alignment_with_n_mutations.R
sim_alignment_with_n_mutations | R Documentation |
The function is used to create both the true (see create_true_alignment) and twin alignment (see sim_twin_alignment).
sim_alignment_with_n_mutations(
phylogeny,
root_sequence,
n_mutations,
mutation_rate = 1,
site_model = beautier::create_jc69_site_model(),
max_n_tries = 100,
verbose = FALSE
)
phylogeny |
a phylogeny of class phylo |
root_sequence |
the DNA sequence at the root of the phylogeny. By default, this will consist out of an equal amount of each letter Use check_root_sequence to check if a root sequence is valid. |
n_mutations |
the number of different base pairs between root sequence and the resulting alignment. Set to NA if any number of mutations is fine. |
mutation_rate |
the mutation rate per base pair per time unit. Use check_mutation_rate to check if a mutation rate is valid. |
site_model |
a nucleotide substitution model, which can be:
|
max_n_tries |
number of attempts to simulate a DNA alignment with the desired number of mutations. If this number of attempts is reached, the funcion will show a warning and return the last DNA alignment simulated. |
verbose |
if TRUE, show more output |
an alignment
an alignment of type DNAbin
Richèl J.C. Bilderbeek, Giovanni Laudanno
Richèl J.C. Bilderbeek
Use create_tral_file to save the simulated alignment directly to a file.
Use sim_tral_with_std_nsm simulate the true alignment with a standard site model. Use sim_twal_with_std_nsm simulate the twin alignment with a standard site model.
# Create the phylogeny to simulate the alignment on
n_taxa <- 5
phylogeny <- ape::rcoal(n_taxa)
# Use default settings to create the alignment
alignment_params <- create_alignment_params()
# Simulate the alignment
alignment <- sim_true_alignment(
true_phylogeny = phylogeny,
alignment_params = alignment_params,
)
check_alignment(alignment)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.