sim_gamete_killing: This function is used to run the generative model to simulate...

View source: R/sim_gamete_killing.R

sim_gamete_killingR Documentation

This function is used to run the generative model to simulate sparse gamete data with transmission distortion caused by gamete killing rhapsodi

Description

This function runs the generative model to simulate input gamete data for rhapsodi. This function samples more gametes than necessary and then to simulate transmission distortion removes a fraction of gametes containing a specific haplotype at a specific SNP. This SNP/haplotype combination can be user-defined or randomly generated. Remaining gametes are sampled such that the desired number remains. In addition to returning gamete data, the function also returns the fully known generated gamete data, this function returns true donor haplotypes and the identity of the SNP and haplotype that are used for transmission distortion simulation

Usage

sim_gamete_killing(
  num_gametes = 500,
  num_snps = 5000,
  p_kill = 0.5,
  killer_snp,
  killer_haplotype,
  recomb_lambda = 1
)

Arguments

num_gametes

an integer, the number of gametes, or the number of columns for the sparse gamete data you want generated

num_snps

an integer, the number of SNPs, or the number of rows for the sparse gamete data you want generated. Note: not all of these will be heterozygous due to the coverage and therefore this number won't necessarily equal the number of SNPs following filtering at the end of the generation

p_kill

a float, the probability that a gamete containing the SNP subject to TD will be removed from the dataset through simulated gamete killing

killer_snp

an integer indicating the specific SNP which will be subject to TD. Randomly selected if not provided by the user.

killer_haplotype

an integer, 0 or 1, indicating which haplotype will be subject to transmission distortion. Randomly selected if not provided by the user.

recomb_lambda

a numeric, the average recombination rate, used as the mean for the poisson distribution

Value

a list of the following: sim_gam_filtered, the simulated gametes; killer_snp, the snp used to simulated gamete killing; killer_haplotype, the haplotype used to simulated gamete killing; donor_haps, the true donor haplotypes


mccoy-lab/rhapsodi documentation built on July 27, 2022, 3:56 a.m.