convertPos: Conversion of genetic map positions

View source: R/map_utils.R

convertPosR Documentation

Conversion of genetic map positions

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

convertPos(
  chrom = NULL,
  Mb = NULL,
  cM = NULL,
  map = "decode19",
  sex = c("average", "male", "female")
)

Arguments

chrom

(Optional) A vector of chromosome labels.

Mb

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

cM

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

map

A genomeMap, a chromMap, or a data frame with columns Mb and cM. By default, loadMap("decode19") is used.

sex

Either "average", "male" or "female".

Value

A vector of the same length as the input.

Examples

# 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, sex = "male")
gen

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


ibdsim2 documentation built on Aug. 17, 2023, 5:17 p.m.