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 viagetSpeciesMinBreedingAge(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 viagetSpeciesMinBreedingAge(2 years when species is unknown); a supplied value overrides that floor.- minParentAge
Deprecated scalar minimum parent age. Supplying it sets both
minSireAgeandminDamAge; use those sex-specific parameters instead.- reportChanges
logical whether to put notices in the result (default FALSE). When TRUE,
changedColsandhasChangedColsin the qcResult report all renamed columns, whilewarningslists 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 makehasErrorsTRUE, and they are left out when errors were found, because no cleaned pedigree exists then. When FALSE,warningsis 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 fromprocessQcStudbookResultcontaining errors, warnings, changedCols, hasErrors, and hasChangedCols.errorLst- The rawnprcgenekeeprErrlist fromqcStudbook's first pass (the same objectqcResultwas derived from), exposed so callers that need the raw fields (e.g.femaleSires,failedDatabaseConnection) do not have to callqcStudbooka 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
}
