Learn R Programming

pedtools (version 0.9.0)

transferMarkers: Transfer marker data

Description

Transfer marker data between pedigrees. Any markers attached to the target are overwritten.

Usage

transferMarkers(from, to, ids = NULL, erase = TRUE,
  matchNames = TRUE)

Arguments

from

a ped or singleton object, or a list of such objects.

to

a ped or singleton object, or a list of such objects.

ids

a vector of ID labels. The indicated individuals must be present in both pedigrees. By default, genotypes are transferred between all shared individuals.

erase

a logical. If TRUE (default), all markers attached to to are erased prior to transfer, and new marker objects are created with the same attributes as in from. If FALSE no new marker objects are attached to to. Only the genotypes of the ids individuals are modified, while genotypes for other pedigree members - and marker attributes - remain untouched.

matchNames

a logical, only relevant if erase = FALSE. If matchNames = TRUE (default) marker names are used to ensure genotypes are transferred into the right markers. The output will contain only the markers in from, in the same order. (An error is raised if the markers are not named.) In this case

Value

A ped object (or a list of such) similar to to, but where all individuals also present in from have marker genotypes copied over. Any previous marker data is erased.

Examples

Run this code
# NOT RUN {
x = nuclearPed(fa = "father", mo = "mother", children = "boy")
m = marker(x, father = 1:2, mother = 1, boy = 1:2)
x = setMarkers(x, m)

y = list(singleton("father"), nuclearPed(mo = "mother", children = "boy"))

# By default all common individuals are transferred
transferMarkers(x, y)

# Transfer data for the boy only
transferMarkers(x, y, ids = "boy")

# Transfer without erasing marker attributes or others genotypes
# Note that `erase = FALSE` requires markers to be named
z = nuclearPed(children = "boy")
z = setMarkers(z, marker(z, '1' = c(2,2), alleles = 1:2, afreq = c(.1, .9)))
name(x, 1) = name(z, 1) = 'M1'
z2 = transferMarkers(x, z, ids = "boy", erase = FALSE)
z2
# Frequencies are not transferred
afreq(z2, 1)

# }

Run the code above in your browser using DataLab