Server logic for summary statistics module displaying genetic analysis results including kinship statistics, histograms, box plots, and relationship designation analysis.
modSummaryStatsServer(
id,
geneticValues,
pedigree,
kinshipMatrix = NULL,
founderStats = NULL,
kinshipOverrides = NULL,
twinRelations = NULL,
kinshipFor = NULL
)A list with reactive components:
summaryData - Summary statistics (nAnimals, meanMK, meanGU)
relationships - Pairwise relationship designations from
convertRelationships(). When kinshipOverrides are supplied,
a logical overridden column flags the pairs whose kinship value
came from an override.
relationClasses - Relationship class frequency table from
makeRelationClassesTable()
firstOrderCounts - First-order relative counts per animal from
countFirstOrder()
mkSummary - Six-number summary of mean kinship
guSummary - Six-number summary of genome uniqueness
mkShape, guShape - Shape statistics (skewness and
kurtosis) of mean kinship and genome uniqueness
mkHistogram, zscoreHistogram, guHistogram -
The histogram plots (ggplot objects)
meanKinshipBoxPlot, zscoreBoxPlot,
guBoxPlot - The box plots (ggplot objects)
character vector of length 1. Module namespace identifier.
reactive returning genetic value analysis results.
Must be a data frame with columns indivMeanKin and gu
(the id column is not read). Optional zScores column (what
reportGV() emits; the legacy name zScore is also
accepted) enables z-score plots.
reactive returning pedigree data frame with columns
id, sire, dam, and sex. Optionally gen.
optional reactive returning kinship matrix. When
supplied it is used unchanged, so it should already carry any twin
correction and kinship overrides. If NULL, or if the reactive errors or
returns NULL, the module asks kinshipFor, then calculates kinship
from the pedigree.
optional reactive returning a list of founder statistics
(fe, fg, total, nMaleFounders,
nFemaleFounders). When supplied, a founder summary table is rendered
on the Summary Statistics tab (monolith parity). If NULL, it is omitted.
optional reactive returning a validated
outside-information kinship-override data frame (id1, id2,
kinship); see applyKinshipOverrides.
When the module recomputes kinship from the pedigree (the fallback; in
the app kinshipFor already applies them), the
overrides are applied to that matrix, so the relationship table and the
kinship CSV export reflect the supplied values regardless of tab order.
The override moves the kinship value only; the relation
label stays pedigree-derived (it is computed from pedigree
structure, not from the kinship value). Overridden pairs are flagged
with a logical overridden column in the relationship table.
NULL (the default) is a no-op.
optional reactive returning a validated twin/zygosity
sidecar data.frame (id1, id2, code); see
checkTwinRelations. When the module recomputes kinship from
the pedigree (the fallback; in the app kinshipFor already
reflects it), it is passed straight through to
kinship so the relationship table and the kinship CSV
export reflect a declared MZ-twin pair's corrected identity regardless
of tab order (BL-N Slice 3). NULL (the default) is a no-op.
optional function of a character vector of animal IDs
that returns those animals' kinship matrix; with no IDs it returns every
animal's. The kinship CSV download and the relationships download ask
it for every animal at each click, and the relationship classes
download asks once and keeps only its class counts, so no kinship
matrix or relationship table is kept between clicks.
appServer passes one that applies the twins and
overrides. A provided kinshipMatrix is used first; with neither,
the module calculates kinship from the pedigree. NULL (the
default) is not used.
This module provides:
Summary statistics (counts, mean kinship, genome uniqueness), a six-number summary with skewness and kurtosis, a founder table and an Effective Population Size block
Histograms and box plots for genetic value distributions, each exportable as PNG (six plots)
Relationship classification using convertRelationships()
Relationship class frequency tables using
makeRelationClassesTable()
First-order relative counts using countFirstOrder()
CSV export for the kinship matrix, founders, relationships, the first-order counts and the relationship class table
modSummaryStatsUI for the user interface
convertRelationships for relationship classification
makeRelationClassesTable for relationship class
summary
countFirstOrder for first-order relative counting
kinship for kinship matrix calculation
Other Shiny modules:
modBreedingGroupsServer(),
modBreedingGroupsUI(),
modCrossCenterIdentityServer(),
modCrossCenterIdentityUI(),
modDeidentifiedExportServer(),
modDeidentifiedExportUI(),
modGeneticDiversityServer(),
modGeneticDiversityUI(),
modGeneticValueServer(),
modGeneticValueUI(),
modGvAndBgDescServer(),
modGvAndBgDescUI(),
modInputServer(),
modInputUI(),
modMarkerGeneticsServer(),
modMarkerGeneticsUI(),
modMatePairServer(),
modMatePairUI(),
modORIPReportingServer(),
modORIPReportingUI(),
modPedigreeServer(),
modPedigreeUI(),
modPotentialParentsServer(),
modPotentialParentsUI(),
modPyramidServer(),
modPyramidUI(),
modSnapshotTrendsServer(),
modSnapshotTrendsUI(),
modSummaryStatsUI()