plot_difference_frequencies: Plot the change in frequency between the start and end of a...

View source: R/plot_difference_frequencies.R

plot_difference_frequenciesR Documentation

Plot the change in frequency between the start and end of a simulation

Description

This function plots the change in frequency of one or multiple ancestors after performing a simulation.

Usage

plot_difference_frequencies(
  results,
  picked_ancestor = "ALL",
  picked_population = 1
)

Arguments

results

An object which is the result of simulate_admixture being a list with four properties: population, frequencies, initial_frequencies and final frequencies

picked_ancestor

Default is "ALL", where different colors indicate different ancestors. Alternatively, for clarity, the user can specify a specific ancestral allele, and only that allele is plotted

picked_population

If multiple populations were simulated (in the case of simulate_admixture_migration), which population should be plotted? Default is population_1.

Value

a ggplot2 object

Examples

s <- 0.1
select_matrix <- matrix(nrow = 1, ncol = 5)
select_matrix[1, ] <- c(0.25, 1.0, 1 + 0.5 * s, 1 + s, 0)

markers <- seq(from = 0.2, to = 0.3, length.out = 100)

selected_pop <- simulate_admixture(
                    module = ancestry_module(number_of_founders = 10,
                                             morgan = 1,
                                             markers = markers),
                    pop_size = 1000,
                    total_runtime = 11,
                    select_matrix = select_matrix)
require(ggplot2)
plot_difference_frequencies(results = selected_pop,
                            picked_ancestor = "ALL")

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