prePed {optiSel}R Documentation

Prepares a Pedigree

Description

Prepares a pedigree by sorting and adding founders and pruning the pedigree.

Usage

prePed(Pedig, keep=NULL, thisBreed=NA, lastNative=NA, addNum=FALSE)

Arguments

Pedig

Data frame containing the pedigree where the first 3 columns correspond to: Individual ID, Sire, and Dam. More columns can be passed in the Pedig argument including columns named Sex, Breed (with breed names), and Born (with years of birth or generation numbers). Missing parents are coded as NA, 0, or "0".

keep

Vector with IDs of individuals, or NULL, or a logical vector indicating the individuals to be kept. If this parameter is not NULL, then only these individuals and their ancestors will be kept in the pedigree.

thisBreed

Name of the breed.

lastNative

Last year of birth for which individuals with unknown pedigree are considered native.

addNum

If TRUE, then columns with IDs of individuals, sires, and dams in integer form will be added.

Details

This function takes a pedigree, adds missing founders, and sorts the pedigree. If parameter keep contains IDs of individuals then only these individuals and their ancestors will be kept in the pedigree.

If the pedigree contains loops, then the loops will be broken by setting the parents of one animal in each loop to NA.

If the pedigree contains columnn Sex then the sexes will be recoded as 'male' and 'female'. Missing sexes will be determined from pedigree structure if possible.

If the pedigree contains column Breed then for ancestors with missing breed the breed name is estimated. If parameter lastNative is not NA then for each animal with one missing parent an imaginary founder is added to the pedigree in order to enable classifying the breed names of all founders as follows: In general animals with missing breed are assumed to have the same breed as most of their offspring. But there is one exception: For founders belonging to thisBreed who are born after lastNative the breed name will be set to "unknown". Moreover for founders from thisBreed with unknown year of birth the breed name will be set to "unknown" if all their descendants are born after lastNative+I.

Value

Data frame containing the pedigree with columns:

Indiv

Character column with IDs of the individuals

Sire

Character column with IDs of the sires

Dam

Character column with IDs of the dams

Sex

Character column with sexes of the individuals denoted as "male" and "female".

Breed

Character column with adjusted breed names of the individuals (only if Pedig has column Breed.).

Born

Numeric column with Year-of-Birth of the individuals (only if Pedig has column Born.).

I

Numeric column with the average age of the parents when the respective individual was born (only if Pedig has column Born.).

numIndiv

Numeric IDs of the individuals, which are equal to the row numbers (only if addNum=TRUE).

numSire

Numeric IDs of the sires (only if addNum=TRUE).

numDam

Numeric IDs of the dams (only if addNum=TRUE).

Offspring

Logical column indicating the individuals with offspring.

Author(s)

Robin Wellmann

Examples

data(PedigWithErrors)
Pedig <- prePed(PedigWithErrors)

tail(Pedig)
hist(Pedig$I, freq=FALSE, ylim=c(0,0.2))

[Package optiSel version 2.0.9 Index]