Learn R Programming

simDNAmixtures (version 1.0.1)

sample_mixtures: Sample mixtures with random genotypes and random parameters according to priors

Description

Sample mixtures with random genotypes and random parameters according to priors

Usage

sample_mixtures(
  n,
  contributors,
  freqs,
  sampling_parameters,
  model_settings,
  sample_model,
  pedigree,
  results_directory,
  seed,
  write_non_contributors = FALSE,
  tag = "simulation"
)

Value

If results_directory is provided, this function has the side effect of writing results to disk.

Return value is a list with simulation results:

  • call matched call

  • smash DataFrame with all samples in SMASH format (see SMASH_to_wide_table)

  • samples Detailed results for each sample

  • parameter_summary DataFrame with parameters for each sample

Arguments

n

Integer. Number of samples.

contributors

Character vector with unique names of contributors. Valid names are "U1", "U2", ... for unrelated contributors or the names of pedigree members for related contributors.

freqs

Allele frequencies (see read_allele_freqs)

sampling_parameters

List. Passed to the sample_model function.

model_settings

List. Passed to the sample_model function.

sample_model

Function such as sample_log_normal_model.

pedigree

(optionally) ped object. Contributors can be named pedigree members.

results_directory

(optionally) Character with path to directory where results are written to disk.

seed

(optionally) Integer seed value that can be used to get reproducible runs. If results are written to disk, the 'Run details.txt' file will contain a seed that can be used for reproducing the result.

write_non_contributors

Logical. If TRUE, sampled genotypes for non-contributing pedigree members will also be written to disk. Defaults to FALSE.

tag

Character. Used for sub directory name when results_directory is provided.

Examples

Run this code
freqs <- read_allele_freqs(system.file("extdata","FBI_extended_Cauc.csv",
                           package = "simDNAmixtures"))
data(gf)

sampling_parameters <- list(min_mu = 50., max_mu = 5e3,
                           min_cv = 0.05, max_cv = 0.35,
                           degradation_shape1 = 10, degradation_shape2 = 1)

mixtures <- sample_mixtures(n = 2, contributors = c("U1", "U2"), freqs = freqs,
                            sampling_parameters = sampling_parameters,
                            model_settings = gf$gamma_settings_no_stutter,
                            sample_model = sample_gamma_model)

Run the code above in your browser using DataLab