Learn R Programming

pedtools (version 2.9.0)

getGenotypes: Genotype matrix

Description

Extract the genotypes of specified individuals and markers from a pedigree object, and return them as a character matrix.

Usage

getGenotypes(
  x,
  ids = NULL,
  markers = NULL,
  sep = "/",
  missing = "-",
  Xchrom = NULL
)

Value

getGenotypes() returns a character matrix with length(ids) rows and length(markers) columns.

Arguments

x

A ped object or a list of such.

ids

A vector of ID labels, or a function operating on x, e.g., typedMembers(). By default (ids = NULL) all individuals are included, also non-genotyped ones.

markers

A vector of indices or names of markers attaches to x. If NULL (default) all markers are included.

sep

A single string to be used as allele separator in marker genotypes.

missing

A single string to be used for missing alleles.

Xchrom

A single logical, or NULL (default). May be used to indicate if all (or none) markers are on X, if this is known in advance.

See Also

getAlleles()

Examples

Run this code
x = nuclearPed() |>
  addMarker(`2` = "1/2", name = "m1") |>
  addMarker(`3` = "a/a", name = "m2")

getGenotypes(x)

### A list of pedigrees

s = transferMarkers(x, singleton("s"))
peds = list(x, s)

getGenotypes(peds)

# Using a function to select individuals
getGenotypes(x, ids = typedMembers)

Run the code above in your browser using DataLab