Learn R Programming

nprcgenekeepr (version 3.0.0)

addGenotype: Add genotype data to pedigree file

Description

Assumes genotype has been opened by checkGenotypeFile

Usage

addGenotype(ped, genotype)

Value

A plain data.frame (not a special pedigree class) with the rows of ped plus integer columns first and second

holding the allele codes (numbered from 10001).

Arguments

ped

pedigree dataframe. ped is to be provided by qcStudbook so it is not checked.

genotype

genotype dataframe. genotype is to be provided by checkGenotypeFile so it is not checked.

Details

The two allele columns are coerced to character internally so the name-keyed allele dictionary is both built and indexed by allele label. This keeps the integer encoding consistent even when the allele columns are supplied as factors (a factor would otherwise be indexed by its integer codes). The allele columns are taken by position (columns 2 and 3 of genotype), not by name. The result is the output of a full outer merge() on id, so genotype ids that are absent from ped are added as extra rows.

Examples

Run this code
library(nprcgenekeepr)
rhesusPedigree <- nprcgenekeepr::rhesusPedigree
rhesusGenotypes <- nprcgenekeepr::rhesusGenotypes
pedWithGenotypes <- addGenotype(
  ped = rhesusPedigree,
  genotype = rhesusGenotypes
)

Run the code above in your browser using DataLab