create_twal_file: Simulates a twin DNA alignment and saves it to a FASTA file.

View source: R/create_twal_file.R

create_twal_fileR Documentation

Simulates a twin DNA alignment and saves it to a FASTA file.

Description

The simulation is performed by sim_twin_alignment.

Usage

create_twal_file(twin_phylogeny, alignment_params, twinning_params)

Arguments

twin_phylogeny

a phylogeny of class phylo

alignment_params

parameters to simulate an alignment, as can be created by create_alignment_params

twinning_params

can be NA if no twinning is desired, or can be the twinning parameters, as can be created by create_twinning_params

Value

nothing

Author(s)

Richèl J.C. Bilderbeek

See Also

Use sim_twin_alignment to only simulate the twin alignment, without saving the alignment to file

Examples

# Check cleanup by other functions
beastier::check_empty_beaustier_folders()

# Create a true phylogeny to simulate the DNA sequences on
n_taxa <- 5
set.seed(1)
phylogeny <- ape::rcoal(n_taxa)

# Create the ancestor's DNA sequence
n_base_pairs <- 4
root_sequence <- create_blocked_dna(length = n_base_pairs)

# Simulate and save the true alignment
alignment_params <- create_alignment_params(
  root_sequence = root_sequence
)
create_tral_file(
  phylogeny = phylogeny,
  alignment_params = alignment_params
)

# Create a twin phylogeny to simulate the DNA sequences on
set.seed(2)
twin_phylogeny <- ape::rcoal(n_taxa)

# File does not exist yet
twinning_params <- create_twinning_params()

# Simulate and save the twin alignment
alignment <- create_twal_file(
 twin_phylogeny = twin_phylogeny,
 alignment_params = alignment_params,
 twinning_params = twinning_params
)

# File is at twinning_params$twin_alignment_filename

# Cleanup
beastier::remove_beaustier_folders()
beastier::check_empty_beaustier_folders()

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