genedrop_multi: 'genedrop_multi()': Conduct a genedrop simulation for a...

View source: R/genedrop_multi.R

genedrop_multiR Documentation

'genedrop_multi()': Conduct a genedrop simulation for a multi-allelic locus.

Description

This function conducts a genedrop simulation for a single bi-allelic locus (e.g. a SNP). For biallelic loci (e.g. SNPs), please use 'genedrop_snp()'. At present, this package does not support sex-linked multi-allelic loci. Before running this function, users should first summarise and visualise their data using 'summary_cohort()' to determine an appropriate value for 'n_founder_cohorts'. This function will return an object that contains the cohort allele frequences in the observed and simulated datasets. Overall results of directional and balancing selection can be observed using 'summary()'. For more detail on specifying model parameters, please consult the tutorial at https://github.com/susjoh/genedroppeR.

Usage

genedrop_multi(
  id,
  mother,
  father,
  cohort = NULL,
  genotype,
  genotype_delim = "",
  nsim,
  n_founder_cohorts = 1,
  fix_founders = TRUE,
  verbose = TRUE,
  interval = 100,
  resample_offspring = FALSE,
  remove_founders = TRUE,
  return_full_results = NULL
)

Arguments

id

vector. Individual IDs

mother

vector. Maternal IDs corresponding to id.

father

vector. Paternal IDs corresponding to id.

cohort

vector (optional). Cohort number (e.g. birth year) corresponding to the id. Must be consecutive integers.

genotype

vector. Genotype IDs corresponding to id.

genotype_delim

char. A character denoting the genotype delimited. Default = "".

nsim

integer. Number of genedrop simulations to run.

n_founder_cohorts

integer. The number of cohorts at the top of the pedigree that will sample from the true allele frequences (these are defined as "sampled"). All cohorts following these ones are "simulated" and are used for comparisons of changes in allele frequency.

fix_founders

logical. Default = TRUE. Determines whether individuals in founder cohorts should be given their true recorded genotypes (if known). For individuals with no known genotype, their genotypes are sampled based on the observed cohort allele frequency. If FALSE, then all IDs are sampled based on the cohort allele frequencies.

verbose

logical. Output the progress of the run.

interval

int. Default 100. Output progress every 100 simulations.

resample_offspring

logical. Default = FALSE. If FALSE, the same pedigree structure as the observed pedigree is used. If TRUE, then offspring are resampled across parents in each cohort. This is to remove any potential signal where prolific individuals tend to have prolific offspring, but will also mean that pedigrees are not directly comparable.

remove_founders

Default = TRUE. If TRUE, then the founder cohorts will be removed from calculations of directional and cumulative change.

return_full_results

Default = NULL. This will also output tables of all individually simulated genotypes.

Value

an output object of class "genedroppeR"

Examples

data(unicorn)
sub_unicorn <- subset(unicorn, cohort < 2010)
genedrop_obj <- genedrop_multi(
  id = sub_unicorn$id,
  mother = sub_unicorn$mother,
  father = sub_unicorn$father,
  cohort = sub_unicorn$cohort,
  genotype = sub_unicorn$MHC,
  nsim = 10,
  n_founder_cohorts = 4,
  fix_founders = TRUE,
  verbose = TRUE,
  interval = 1,
  resample_offspring = FALSE
)

summary_genedrop(genedrop_obj)
plot_genedrop(genedrop_obj)

susjoh/genedroppeR documentation built on Sept. 9, 2024, 3:19 a.m.