Skip to contents

Wrapper function that runs qcStudbook and processes results into a format suitable for Shiny UI display. This function performs two passes: first to check for errors, then to get the cleaned data if no errors exist.

Usage

runQcStudbook(
  ped,
  minSireAge = NULL,
  minDamAge = NULL,
  minParentAge = lifecycle::deprecated(),
  reportChanges = FALSE
)

Arguments

ped

data.frame containing pedigree data with columns including id, sire, dam, sex, and birth (all required), and optionally death, departure, etc.

minSireAge

numeric minimum age in years for a male to have sired an offspring. NULL (default) looks up each sire's species floor via getSpeciesMinBreedingAge (2 years when species is unknown); a supplied value overrides that floor.

minDamAge

numeric minimum age in years for a female to have borne an offspring. NULL (default) looks up each dam's species floor via getSpeciesMinBreedingAge (2 years when species is unknown); a supplied value overrides that floor.

minParentAge

[Deprecated] Deprecated scalar minimum parent age. Supplying it sets both minSireAge and minDamAge; use those sex-specific parameters instead.

reportChanges

logical whether to put notices in the result (default FALSE). When TRUE, changedCols and hasChangedCols in the qcResult report all renamed columns, while warnings lists the case and space changes and, when animals in the cleaned pedigree have no birth date, one warning, "Animals with no birth date", that says how many. When animals have an exit date earlier than their birth date, one more warning, "Animals with a death or departure before birth", says how many and names the first five. These warnings are notices only: they never make hasErrors TRUE, and they are left out when errors were found, because no cleaned pedigree exists then. When FALSE, warnings is empty.

Value

A list with the following components:

  • cleaned - The cleaned pedigree data.frame with standardized column names, added generation numbers, etc. NULL if errors were found.

  • qcResult - Result from processQcStudbookResult containing errors, warnings, changedCols, hasErrors, and hasChangedCols.

  • errorLst - The raw nprcgenekeeprErr list from qcStudbook's first pass (the same object qcResult was derived from), exposed so callers that need the raw fields (e.g. femaleSires, failedDatabaseConnection) do not have to call qcStudbook a second time themselves.

See also

qcStudbook for the underlying QC function

processQcStudbookResult for result processing

modInputServer for Shiny module integration

Examples

data("pedGood", package = "nprcgenekeepr")
result <- runQcStudbook(pedGood, minSireAge = 2.0, minDamAge = 2.0)
if (!result$qcResult$hasErrors) {
  cleanedPed <- result$cleaned
}