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

View source: R/sim_gene_conversion.R

sim_gene_conversionR Documentation

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

Description

This function runs the generative model to simulate input gamete data for rhapsodi. To simulate transmission distortion, a SNP is chosen as the start of a gene conversion event, the length of which is sampled from the Poisson distribution. Haplotypes are bit inverted for a user-defined fraction of gametes containing this SNP/haplotype combination. 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_gene_conversion(
  num_gametes = 500,
  num_snps = 5000,
  p_convert = 0.5,
  conversion_lambda = 4,
  converted_snp,
  converted_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_convert

a float, the probability that a gamete with the TD allele will undergo a gene conversion event

conversion_lambda

a float, used as lambda in the Poisson distribution to determine the length of the gene conversion event

converted_snp

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

converted_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; converted_snp, the snp used to simulated gene conversion; converted_haplotype, the haplotype used to simulated gene conversion; donor_haps, the true donor haplotypes


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