library(nprcgenekeepr)
examplePedigree <- nprcgenekeepr::examplePedigree
breederPed <- qcStudbook(examplePedigree,
minParentAge = 2,
reportChanges = FALSE,
reportErrors = FALSE
)
focalAnimals <- breederPed$id[!(is.na(breederPed$sire) &
is.na(breederPed$dam)) &
is.na(breederPed$exit)]
ped <- setPopulation(ped = breederPed, ids = focalAnimals)
trimmedPed <- trimPedigree(focalAnimals, breederPed)
probands <- ped$id[ped$population]
ped <- trimPedigree(probands, ped,
removeUninformative = FALSE,
addBackParents = FALSE
)
geneticValue <- reportGV(ped,
guIter = 50, # should be >= 1000
guThresh = 3,
byID = TRUE,
updateProgress = NULL
)
trimmedGeneticValue <- reportGV(trimmedPed,
guIter = 50, # should be >= 1000
guThresh = 3,
byID = TRUE,
updateProgress = NULL
)
candidates <- trimmedPed$id[trimmedPed$birth < as.Date("2013-01-01") &
!is.na(trimmedPed$birth) &
is.na(trimmedPed$exit)]
haremGrp <- groupAddAssign(
kmat = trimmedGeneticValue[["kinship"]],
ped = trimmedPed,
candidates = candidates,
iter = 10, # should be >= 1000
numGp = 6,
harem = TRUE
)
haremGrp$group
sexRatioGrp <- groupAddAssign(
kmat = trimmedGeneticValue[["kinship"]],
ped = trimmedPed,
candidates = candidates,
iter = 10L, # should be >= 1000L
numGp = 6L,
sexRatio = 9.0
)
sexRatioGrp$group
Run the code above in your browser using DataLab