sim.seqs: Simulate DNA sequences according to DNA substitution models

View source: R/sim.seqs.R

sim.seqsR Documentation

Simulate DNA sequences according to DNA substitution models

Description

Simulates DNA sequences according to various DNA substitution models:

  • Jukes-Cantor (1969)

  • Kimura (1980)

  • Felsenstein (1981)

  • Hasegawa-Kishino-Yano (1985)

Output can then be passed to HACReal().

Usage

sim.seqs(num.seqs, num.haps, length.seqs, count.haps, nucl.freqs, 
codon.tbl = c("standard", "vertebrate mitochondrial", 
"invertebrate mitochondrial"), subst.model = c("JC69", "K80", "F81", "HKY85"), 
mu.rate, transi.rate, transv.rate)

Arguments

num.seqs

Number of simulated DNA sequences

num.haps

Number of simulated unique species' haplotypes

length.seqs

Basepair length of DNA sequences

count.haps

Haplotype frequency distribution vector

nucl.freqs

Nucleotide frequency distribution vector of A, C, G, and T respectively

codon.tbl

Codon table

subst.model

Model of DNA substitution

mu.rate

Overall nucleotide mutation rate/site/generation

transi.rate

Nucleotide transition rate/site/generation

transv.rate

Nucleotide transversion rate/site/generation

Value

A FASTA file of DNA sequences

Note

num.seqs must be greater than or equal to num.haps.

Both num.seqs and num.haps must be greater than 1.

nucl.freqs must have a length of four and its elements must sum to 1.

count.haps must have a length of num.haps and its elements must sum to num.seqs.

subst.model must be one of "JC69" (Jukes Cantor corrected p-distance), "K80" (Kimura-2-Parameter (K2P), "F81" (Felenstein) or "HKY85" (Hasegawa-Kishino-Yano)

mu.rate must be specified for both "JC69" and "F81" models

transi.rate and transv.rate must be specified for both "K80" and "HKY85" models

All elements nucl.freqs must be equal to 0.25 when subst.model is either "JC69" or "K80"

All elements nucl.freqs must differ from 0.25 when subst.model is either "F81" or "HKY85"

Examples


## Not run: 

# Simulate DNA sequences from the 5'-COI DNA barcode region under a Jukes 
# Cantor nucleotide substitution model

num.seqs <- 100 # number of DNA sequences
num.haps <- 10 # number of haplotypes
length.seqs <- 658 # length of DNA sequences
count.haps <- c(65, rep(10, 2), rep(5, 2), rep(1, 5)) # haplotype frequency distribution
nucl.freqs <- rep(0.25, 4) # nucleotide frequency distribution
subst.model <- "JC69" # desired nucleotide substitution model
codon.tbl <- "vertebrate mitochondrial"
mu.rate <- 1e-3 # mutation rate
transi.rate <- NULL # transition rate
transv.rate <- NULL # transversion rate

sim.seqs(num.seqs = num.seqs, num.haps = num.haps, length.seqs = length.seqs, 
count.haps = count.haps, nucl.freqs = nucl.freqs, codon.tbl = codon.tbl, 
subst.model = subst.model, mu.rate = mu.rate, transi.rate = transi.rate, 
transv.rate = transv.rate)


## End(Not run)


HACSim documentation built on June 13, 2022, 9:05 a.m.