calc_haplotype_freq: Calculate the frequency of haplotypes

View source: R/allele_functions.R

calc_haplotype_freqR Documentation

Calculate the frequency of haplotypes

Description

Calculates the frequency of haplotypes given a list of vectors of loci.

Usage

calc_haplotype_freq(genome, pop, loci.list)

Arguments

genome

An object of class genome.

pop

A population.

loci.list

A list of vectors of loci names for which haplotype frequencies should be calculated.

Value

A list of haplotype frequencies

Examples

n.mar  <- c(505, 505, 505)
len <- c(120, 130, 140)

genome <- sim_genome(len, n.mar)

# Randomly generate 15 QTL with additive allelic effects following a
# genometric series
qtl.model <- matrix(nrow = 15, ncol = 4)
genome <- sim_gen_model(genome, qtl.model, add.dist = "geometric")

# Create a random population
pop <- sim_pop(genome = genome, n.ind = 200)

# Sample 2 pairs of QTL
loci.list <- replicate(n = 2, sample(qtlnames(genome), 2), simplify = FALSE)

# Calculate haplotype frequencies
calc_haplotype_freq(genome, pop, loci.list)



neyhartj/qgsim documentation built on Nov. 11, 2023, 4:08 p.m.