calculate_allele_frequencies: Calculate allele frequencies

View source: R/calculate_allele_frequencies.R

calculate_allele_frequenciesR Documentation

Calculate allele frequencies

Description

Calculate for a number of regularly spaced markers the relative frequency of each ancestor in the population.

Usage

calculate_allele_frequencies(
  source_pop,
  locations = seq(0, 1, length.out = 100),
  progress_bar = FALSE
)

Arguments

source_pop

Population for which to estimate allele frequencies

locations

A vector indicating the locations (in Morgan) where to calculate the allele frequencies.

progress_bar

Displays a progress_bar if TRUE. Default value is TRUE

Details

Markers are equidistantly spaced, with a distance of step_size in between them.

Value

A tibble containing the allele frequencies

Examples

number_founders = 20
wildpop =  simulate_admixture(
   module = ancestry_module(number_of_founders = 20, morgan = 1),
   pop_size = 1000,
   total_runtime = 10,
   num_threads = 1)

freq_output <- calculate_allele_frequencies(wildpop,
                                            progress_bar = TRUE)

require(ggplot2)
ggplot(freq_output, aes(x=location, y = frequency,
                        col = as.factor(ancestor))) +
  geom_line()

thijsjanzen/GenomeAdmixR documentation built on Feb. 16, 2024, 7:27 p.m.