HACReal: Set up an object to simulate haplotype accumulation curves...

View source: R/HAC.object.R

HACRealR Documentation

Set up an object to simulate haplotype accumulation curves for a real species

Description

Helper function which creates an object containing necessary information to run a simulation of haplotype accumulation for a real species of interest

Usage

HACReal(perms = 10000, p = 0.95, conf.level = 0.95, 
ci.type = "quantile", subsample = FALSE, prop = NULL, 
progress = TRUE, num.iters = NULL, filename = NULL)

Arguments

perms

Number of permutations (replications)

p

Proportion of haplotypes to recover

conf.level

Desired confidence level for graphical output and interval estimation

ci.type

Type of confidence interval for graphical output. Choose from "quantile" or "asymptotic"

subsample

Is a subsample of DNA sequences desired?

prop

If subsample = TRUE, the proportion of DNA sequences to subsample

num.iters

Number of iterations to compute

progress

Should iteration output be printed to the R console?

filename

Name of file where simulation results are to be saved

Value

A list object of class "HAC" with 13 elements that can be passed to HAC.simrep as follows:

input.seqs

Should a FASTA file of aligned/trimmed DNA sequences be inputted? Default is TRUE

subset.seqs

Should a subsample of DNA sequences be taken? Default is FALSE (can be altered by user)

prop.seqs

Proportion of DNA sequences to subsample. Default is NA (can be altered by user)

prop.haps

Proportion of haplotype labels to subsample. Default is NULL

subset.haps

Should a subsample of haplotype labels be taken? Default is NULL

N

Number of individuals. NA by default (computed automatically by algorithm)

Hstar

Number of unique species' haplotypes. NA by default (computed automatically by algorithm)

probs

Haplotype frequency distribution vector. NA by default (computed automatically by algorithm)

p

Proportion of haplotypes to recover. p = 0.95 by default.

perms

Number of permutations (replications). perms = 10000 by default.

conf.level

Desired confidence level for graphical output and interval estimation. conf.level = 0.95 by default.

ci.type

Type of confidence interval for graphical output. ci.type = "quantile" by default

num.iters

Number of iterations to compute. num.iters = NULL by default (i.e., all iterations are computed; users can specify num.iters = 1 for the first iteration.)

progress

Should iteration output be printed to the R console? Default is TRUE

filename

Name of file where simulation results are to be saved.

Examples

    ## Simulate real species ##
    # outputs file called "output.csv"
    HACSObj <- HACReal(filename = "output") 
    
    ## Simulate real species - subsampling ##
    # subsamples 25% of DNA sequences
    HACSObj <- HACReal(subsample = TRUE, prop = 0.25, conf.level = 0.95, 
    filename = "output") 
    
    ## Simulate real species and all parameters changed - subsampling ##
    HACSObj <- HACReal(perms = 10000, p = 0.90, subsample = TRUE, 
    prop = 0.15, conf.level = 0.99, num.iters = 1, filename = "output")

jphill01/HACSim.R documentation built on March 4, 2024, 2:49 p.m.