prePed: *Pre*pares a *Ped*igree

Description Usage Arguments Details Value Author(s) Examples


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


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



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".


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.


Name of the breed.


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


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


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.


Data frame containing the pedigree with columns:


Character column with IDs of the individuals


Character column with IDs of the sires


Character column with IDs of the dams


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


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


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


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


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


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


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


Logical column indicating the individuals with offspring.


Robin Wellmann


Pedig <- prePed(PedigWithErrors)

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

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
Pedigree loops were detected. We recommend to correct them manually before
using prePed(). The parents of the following individuals are set to unknown
to remove the loops.
                           Sire             Dam
276000802875148 276000803622423 276000890878480
276000811476506 276000810087663 276000811476506

The sex of the following animals was not compatible with the pedigree, so
it was modified:
                           Sire             Dam
276000810087663 276000802940621 276000802925028

                          Indiv            Sire             Dam    Sex
276000813677673 276000813677673 276000813368988 276000812749878 female
276000812771580 276000812771580 276000812771544 276000891438774 female
276000892197676 276000892197676 276000812771544 276000811287686 female
276000813517568 276000813517568 276000813121706 276000812905334 female
276000813752879 276000813752879 276000811903592 276000812803634 female
276000891978029 276000891978029            <NA> 276000891978027 female
                        Breed Born   I Offspring
276000813677673 Hinterwaelder 2007 1.5     FALSE
276000812771580 Hinterwaelder 2006 3.5     FALSE
276000892197676 Hinterwaelder 2006 4.5     FALSE
276000813517568 Hinterwaelder 2007 2.0     FALSE
276000813752879 Hinterwaelder 2007 4.0     FALSE
276000891978029 Hinterwaelder 2008 2.0     FALSE

optiSel documentation built on Jan. 16, 2021, 5:30 p.m.