transferMarkers: Transfer marker data

View source: R/marker_transfer.R

transferMarkersR Documentation

Transfer marker data

Description

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

Usage

transferMarkers(
  from,
  to,
  ids = NULL,
  idsFrom = ids,
  idsTo = ids,
  erase = TRUE,
  matchNames = TRUE,
  checkSex = FALSE
)

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. This should be used only if the individuals have the same name in both pedigrees; otherwise use idsFrom and idsTo instead.

idsFrom, idsTo

Vectors of equal length, denoting source individuals (in the from pedigree) and target individuals (in the to pedigree), respectively.

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 contains only markers present in from, in the same order. (An error is raised if the markers are not named.)

checkSex

A logical. If TRUE, it is checked that fromIds and toIds have the same sex. Default: FALSE.

Details

By default, genotypes are transferred between all individuals present in both pedigrees.

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


x = nuclearPed(fa = "A", mo = "B", child = "C")
x = addMarker(x, A = "1/2", B = "1/1", C = "1/2", name = "M1")

y = list(singleton("A"), nuclearPed(fa = "D", mo = "B", child = "C"))

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

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

# Transfer without first erasing the target markers
z = nuclearPed(fa = "A", mo = "B", child = "C")
z = addMarker(z, A = "1/1", alleles = 1:2, name = "M1")

transferMarkers(x, z, ids = "C", erase = FALSE)
transferMarkers(x, z, ids = "C", erase = TRUE) # note the difference


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