sortGenotypes: Sort the alleles in each genotype

View source: R/marker_sort.R

sortGenotypesR Documentation

Sort the alleles in each genotype

Description

Ensure that all genotypes are sorted internally. For example, if a marker attached to x has alleles 1 and 2, then running this function will replace all genotypes "2/1" by "1/2".

Usage

sortGenotypes(x)

Arguments

x

A ped object or a list of such

Value

An object identical to x except that the all genotypes are sorted.

Examples

x = singleton(1)

# Various markers with misordered genotypes
m1 = marker(x, `1` = "2/1")
m2 = marker(x, `1` = "b/a")
m3 = marker(x, `1` = "100.3/99.1")
x = setMarkers(x, list(m1, m2, m3))
x

# Sort all genotypes
y = sortGenotypes(x)
y

# Also works when input is a list of peds
sortGenotypes(list(x, x))


magnusdv/pedtools documentation built on April 9, 2024, 7:35 a.m.