sim_twal_with_same_n_mutation: Simulate a twin alignment using a standard site model

View source: R/sim_twal_with_same_n_mutation.R

sim_twal_with_same_n_mutationR Documentation

Simulate a twin alignment using a standard site model

Description

This is an adapter function (see https://en.wikipedia.org/wiki/Adapter_pattern), with the purpose of passing check_sim_twal_fun, by being a function with the function arguments twin_phylogeny and true_alignment.

Usage

sim_twal_with_same_n_mutation(
  twin_phylogeny,
  true_alignment,
  root_sequence,
  mutation_rate = 1,
  site_model = beautier::create_jc69_site_model(),
  max_n_tries = 1000,
  verbose = FALSE
)

Arguments

twin_phylogeny

a phylogeny of class phylo

true_alignment

a DNA alignment, of class DNAbin

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.

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:

  • A standard nucloetide substitution model, as created by create_site_model

  • lns: a linked node-substitution model

  • uns: an unlinked node-substitution model

max_n_tries

maximum number of tries before giving up

verbose

if TRUE, show more output

Value

an alignment

Author(s)

Richèl J.C. Bilderbeek

See Also

Use sim_twin_alignment to use this function to create a twin alignment

Examples


# This adapter function must be a sim_twin_alignment function
check_sim_twal_fun(
  sim_twal_with_std_nsm
)

# Simulate a twin DNA alignment

alignment <- sim_twal_with_std_nsm(
  twin_phylogeny = ape::read.tree(text = "((A:1, B:1):2, C:3);"),
  root_sequence = "aaaa",
  mutation_rate = 0.1
)
check_alignment(alignment)

richelbilderbeek/pirouette documentation built on Oct. 18, 2023, 3:09 p.m.