Turns 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.
createColonySnapshot(
ped,
geneticValue,
membershipRule,
guIter,
guThresh,
snapshotDate = Sys.Date()
)A one-row data.frame in the 27-column snapshot-history schema;
it passes checkSnapshotHistory unchanged.
The pedigree data.frame the reportGV analysis was run
on, carrying at least an id column (plus the logical
population column when membershipRule is
"focalPopulation" or "reconstructedLiving").
An object of class nprcgenekeeprGV as returned
by reportGV.
Single string naming how the analysis population
was assembled; one of "wholePedigree", "focalPopulation" or
"reconstructedLiving".
Single positive whole number: the guIter value the
reportGV call used. Required — there is no default.
Single positive whole number: the guThresh value
the reportGV call used. Required — there is no default.
The snapshot's date: a Date or an ISO-8601
(YYYY-MM-DD) string. Defaults to Sys.Date().
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"ped carries the logical
population column (see setPopulation) and the report
covers exactly ped$id[ped$population]. Pass the same
population-designated pedigree the reportGV call analyzed.
"reconstructedLiving"the snapshot was rebuilt for a past
date from the pedigree's birth and exit dates (see
backfillColonySnapshots). It is verified exactly like
"focalPopulation", but is a separate rule so a rebuilt row never
mixes with a recorded one: rules are never compared with each other.
ped <- nprcgenekeepr::qcPed
gv <- reportGV(ped, guIter = 10L)
snapshot <- createColonySnapshot(ped, gv, "wholePedigree",
guIter = 10L, guThresh = 1L
)
history <- appendColonySnapshot(NULL, snapshot)
Run the code above in your browser using DataLab