getMap: Tabulate marker positions

View source: R/getMap.R

getMapR Documentation

Tabulate marker positions

Description

Return a map of the markers attached to a pedigree.

Usage

getMap(x, markers = NULL, na.action = 0, merlin = FALSE, verbose = TRUE)

setMap(x, map, matchNames = NA, ...)

hasLinkedMarkers(x)

Arguments

x

An object of class ped or a list of such.

markers

A vector of names or indices referring to markers attached to x. By default, all markers are included.

na.action

Either 0 (default), 1 or 2. (See Details.)

merlin

A logical mostly for internal use: If TRUE the function returns a matrix instead of a data frame.

verbose

A logical.

map

Either a data frame or the path to a map file. See Details regarding format.

matchNames

A logical; if TRUE, pre-existing marker names of x will be used to assign chromosome labels and positions from map.

...

Further arguments passed to read.table().

Details

The na.action argument controls how missing values are dealt with:

  • na.action = 0: Return map unmodified

  • na.action = 1: Replace missing values with dummy values.

  • na.action = 2: Remove markers with missing data.

In setMap(), the map argument should be a data frame (or file) with the following columns in order:

  1. chromosome

  2. marker name

  3. position (Mb)

Column names are ignored, as are any columns after the first three.

Value

getMap() returns a data frame with columns CHROM, MARKER and MB.

setMap() returns x with modified marker attributes.

hasLinkedMarkers() returns TRUE if two markers are located (with set position) on the same chromosome, and FALSE otherwise.

Examples

x = singleton(1)
m1 = marker(x, chrom = 1, posMb = 10, name = "m1")
m2 = marker(x, chrom = 1, posMb = 11)
m3 = marker(x, chrom = 1)
x = setMarkers(x, list(m1, m2, m3))

# Compare effect of `na.action`
getMap(x, na.action = 0)
getMap(x, na.action = 1)
getMap(x, na.action = 2)

# Getting and setting map are inverses
y = setMap(x, getMap(x))
stopifnot(identical(x,y))

hasLinkedMarkers(x)


pedtools documentation built on Nov. 5, 2023, 5:06 p.m.