Server logic for breeding group formation using the groupAddAssign algorithm. This module integrates with the kinship-based maximal independent set (MIS) algorithm to form optimal breeding groups that minimize relatedness within groups while maximizing group sizes.
Usage
modBreedingGroupsServer(
id,
pedigree,
geneticValues = NULL,
kinshipMatrix = NULL,
kinshipOverrides = NULL
)Arguments
- id
character vector of length 1. Module namespace identifier.
- pedigree
reactive returning pedigree data frame with columns: id, sire, dam, sex, and optionally birth, exit, gen.
- geneticValues
optional reactive returning genetic value results from
modGeneticValueServer, used to source thetopRankedanimal-source candidate list. Unrelated to kinship.- kinshipMatrix
optional reactive returning a kinship matrix, typically a full-pedigree matrix shared with
modSummaryStatsServer(e.g. fromappServer) rather than independently recomputed. If NULL, the module calculates kinship from the pedigree.- kinshipOverrides
optional reactive returning a validated outside-information kinship-override data frame (
id1,id2,kinship); seeapplyKinshipOverrides. When the module recomputes kinship from the pedigree (the sharedkinshipMatrixis unavailable), the overrides are applied to that matrix so group formation reflects them regardless of tab order.NULL(the default) is a no-op. A providedkinshipMatrixis expected to already carry overrides applied at its source.
Value
List with reactive components:
groups- List of character vectors with animal IDs per groupnGroups- Number of groups formedscore- Optimization score from groupAddAssign (minimum group size)unassigned- Character vector of candidate IDs not placed in groupsgroupKinship- List of kinship matrices per group (if withKin=TRUE)
Details
The module supports multiple configuration options:
Animal source: Select top-ranked animals or all available
Kinship threshold: Maximum allowed kinship within groups
Harem mode: Form groups with exactly one male each
Sex ratio: Target female-to-male ratio in groups
See also
modBreedingGroupsUI for the UI component
groupAddAssign for the underlying MIS algorithm
modGeneticValueServer for genetic value analysis
kinship for kinship matrix calculation
Other Shiny modules:
modBreedingGroupsUI(),
modGeneticDiversityServer(),
modGeneticDiversityUI(),
modGeneticValueServer(),
modGeneticValueUI(),
modGvAndBgDescServer(),
modGvAndBgDescUI(),
modInputServer(),
modInputUI(),
modORIPReportingServer(),
modORIPReportingUI(),
modPedigreeServer(),
modPedigreeUI(),
modPotentialParentsServer(),
modPotentialParentsUI(),
modPyramidServer(),
modPyramidUI(),
modSummaryStatsServer(),
modSummaryStatsUI()
