convertPos: Conversion of genetic map positions

Description Usage Arguments Value Examples

View source: R/map_utils.R

Description

Convert between physical position (in megabases) and genetic position (centiMorgan) given a chromosome map. Linear extrapolation is used to convert positions between map points.

Usage

1
convertPos(Mb = NULL, cM = NULL, map)

Arguments

Mb

A vector of physical positions (in Mb), or NULL.

cM

A vector of genetic positions (in cM), or NULL.

map

A data frame with columns Mb and cM.

Value

A vector of the same length as the input.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Chromosome 1 of the built-in recombination map
map = loadMap(chrom = 1)[[1]]
head(map$male)

# Conversion Mb -> cM
phys = 1:5
gen = convertPos(Mb = phys, map = map$male)
gen

# Convert back (note the first position, which was outside of map)
convertPos(cM = gen, map = map$male)

ibdsim2 documentation built on Nov. 13, 2020, 5:06 p.m.