
Create a colony snapshot row from a genetic value report
Source:R/createColonySnapshot.R
createColonySnapshot.RdTurns one reportGV result into a one-row data.frame in the
27-column snapshot-history schema (issue #167, schema version 1), ready
for appendColonySnapshot. Every metric field is a value the
nprcgenekeeprGV object already carries, or a Summary Statistics
aggregate (mean/median/calcSkewness/
calcKurtosis, NA removed) of its per-animal
indivMeanKin/gu/guSE report columns, stored at full
precision — no estimator is recomputed or duplicated.
Usage
createColonySnapshot(
ped,
geneticValue,
membershipRule,
guIter,
guThresh,
snapshotDate = Sys.Date()
)Arguments
- ped
The pedigree data.frame the
reportGVanalysis was run on, carrying at least anidcolumn (plus the logicalpopulationcolumn whenmembershipRuleis"focalPopulation").- geneticValue
An object of class
nprcgenekeeprGVas returned byreportGV.- membershipRule
Single string naming how the analysis population was assembled; one of
"wholePedigree"or"focalPopulation".- guIter
Single positive whole number: the
guItervalue thereportGVcall used. Required — there is no default.- guThresh
Single positive whole number: the
guThreshvalue thereportGVcall used. Required — there is no default.- snapshotDate
The snapshot's date: a
Dateor an ISO-8601 (YYYY-MM-DD) string. Defaults toSys.Date().
Value
A one-row data.frame in the 27-column snapshot-history schema;
it passes checkSnapshotHistory unchanged.
Details
guIter and guThresh are required because the
reportGV return object does not carry them, and they are
comparability provenance the snapshot must record truthfully: pass
exactly the values the reportGV call used (its defaults are
1000L and 1L).
The claimed membershipRule is verified against ped and the
report, and a contradiction stops:
"wholePedigree"the report covers exactly the animals in
ped."focalPopulation"pedcarries the logicalpopulationcolumn (seesetPopulation) and the report covers exactlyped$id[ped$population]. Pass the same population-designated pedigree thereportGVcall analyzed.
Examples
ped <- nprcgenekeepr::qcPed
gv <- reportGV(ped, guIter = 10L)
snapshot <- createColonySnapshot(ped, gv, "wholePedigree",
guIter = 10L, guThresh = 1L
)
history <- appendColonySnapshot(NULL, snapshot)