recomb_map_simplify_chr: Simplify recombination map of one chromosome to a desired...

View source: R/recomb_map_simplify_chr.R

recomb_map_simplify_chrR Documentation

Simplify recombination map of one chromosome to a desired numerical precision

Description

Given an input recombination map, this function iteratively removes rows that can be interpolated to less than a given error tol. This is a heuristic that works very well in practice, resulting in average interpolation errors well below tol, and maximum final errors no greater than 3 * tol in our internal benchmarks (expected in extremely concave or convex regions of the map; final errors are rarely above tol with few exceptions).

Usage

recomb_map_simplify_chr(map, tol = 0.1)

Arguments

map

A tibble with two columns: pos position in base pairs, and posg position in centiMorgans (cM).

tol

Tolerance of interpolation errors, in cM.

Details

This function reduces recombination map sizes drastically, in order to include them in packages, and also makes linear interpolation faster. This simplification operation can be justified as the precision of many existing maps is both limited and overstated, and a high accuracy is not needed for simulations with many other approximations in place.

Value

The recombination map with rows (positions) removed (if they are interpolated with errors below tol in most cases).

See Also

recomb_map_fix_ends_chr() to shift and extrapolate recombination map to ends of chromosome.

Examples

library(tibble)
# create a toy recombination map to simplify
# in this case all middle rows can be interpolated from the ends with practically no error
map <- tibble(
    pos  = c(  1L, 1e6L, 2e6L, 3e6L ),
    posg = c( 0.0,  1.0,  2.0,  3.0 )
)

# simplify map!
map_simple <- recomb_map_simplify_chr( map )
# inspect
map_simple


simfam documentation built on Jan. 10, 2023, 1:06 a.m.