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

View source: R/genedrop_snp.R

genedrop_snpR Documentation

'genedrop_snp()': Conduct a genedrop simulation for a biallelic locus.

Description

This function conducts a genedrop simulation for a single bi-allelic locus (e.g. a SNP). For multi-allelic loci, use 'genedrop_multi()' and for sex-linked loci, use 'genedrop_snp_sexlinked()'. 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_snp(
  id,
  mother,
  father,
  cohort = NULL,
  genotype,
  nsim = 1000,
  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. Genotypes corresponding to id.

nsim

integer. Default 1000. 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 frequencies (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. Default = TRUE. Output the progress of the run.

interval

integer. Default 100. Output progress every 'interval' 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. See the package documentation for detailed discussion on making this decision.

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)
genedrop_obj <- genedrop_snp(
  id = unicorn$id,
  mother = unicorn$mother,
  father = unicorn$father,
  cohort = unicorn$cohort,
  genotype = unicorn$Horns,
  nsim = 100,
  n_founder_cohorts = 4,
  fix_founders = TRUE,
  verbose = TRUE,
  interval = 10,
  resample_offspring = FALSE
)
summary_genedrop(genedrop_obj)
plot_genedrop(genedrop_obj)

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