create_population_selection: Create a population taking into account selection

Description Usage Arguments Value Author(s) Examples

Description

Create a population while specific genomic areas are under selection to be of a specific ancestor.

Usage

1
2
3
4
create_population_selection(pop_size, number_of_founders,
            total_runtime, morgan, select_matrix,
            seed, track_frequency = FALSE, progress_bar = TRUE,
            multiplicative_selection = TRUE)

Arguments

pop_size

Number of individuals in the population

number_of_founders

Number of unique ancestors

total_runtime

Number of generations allowed for inbreeding

morgan

Length of the chromosome in Morgan (e.g. the number of crossovers during meiosis)

select_matrix

Selection matrix indicating the markers which are under selection. Each row in the matrix contains five entries: location location of the marker under selection (in Morgan) fitness of wildtype (aa) fitness of heterozygote (aA) fitness of homozygote mutant (AA) Ancestral type that representes the mutant allele A

seed

Seed of the pseudo-random number generator

track_frequency

If TRUE, every generation the frequency of all ancestors at the marker under selection is tracked. Currently only supports one marker under selection. track_frequency If TRUE, every generation the frequency of all ancestors at the marker under selection is tracked. Currently only supports one marker under selection. Alternatively, the user can provide a region for which a fixed number of markers is tracked. The user does this by providing a vector with three entries: start, end, number_of_markers.

progress_bar

Displays a progress_bar if TRUE. Default value is TRUE

multiplicative_selection

Default: TRUE. If TRUE, fitness is calculated for multiple markers by multiplying fitness values for each marker. If FALSE, fitness is calculated by adding fitness values for each marker.

Value

A list with: population a population object, and three tibbles with allele frequencies: frequencies (if track_frequency = TRUE), initial_frequencies and final_frequencies. Each tibble contains four columns, time, location, ancestor and frequency, which indicates the number of generations, the location along the chromosome of the marker, the ancestral allele at that location in that generation, and finally, the frequency of that allele.

Author(s)

Thijs Janzen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
selection_matrix <- matrix(ncol=5, nrow = 1)
selection_matrix[1,] <- c(0.5, 1.0, 1.0, 1.2, 1)

selected_pop <- create_population_selection(pop_size = 100,
                                            number_of_founders = 10,
                                            total_runtime = 10,
                                            morgan = 1,
                                            selection_matrix,
                                            seed = 12345,
                                            progress_bar = TRUE)

thijsjanzen/isoSIM documentation built on May 29, 2019, 10:39 a.m.