Learn R Programming

nprcgenekeepr (version 3.0.0)

modPedigreeServer: Pedigree Browser Module - Server Function

Description

Server logic for pedigree browser module handling focal animal selection (typed, pasted or uploaded, or set by clicking a diagram node), pedigree processing, filtering (focal trim and the Display Unknown IDs filter), the Diagram tab (edge style, names, twin connectors, PNG export), the twin/zygosity sidecar upload, and data export.

Usage

modPedigreeServer(id, studbook)

Value

A list of reactive values:

  • pedigree - Filtered pedigree for display (respects trim/unknown settings)

  • analysisPedigree - The pedigree the other tabs analyze (focal-animal trim applied, no Display Unknown IDs filter, which affects only the table); appServer uses it, not pedigree, as the shared current pedigree

  • processedPedigree - Full pedigree with population, pedNum, gen columns

  • focalAnimals - Character vector of focal animal IDs

  • nAnimals - Count of animals in filtered pedigree

  • populationCount - Count of animals marked as population

  • isReady - Logical indicating if pedigree data is ready. With no studbook loaded, isReady() and nAnimals() halt with a silent req error instead of returning FALSE and 0

  • twinRelations - The validated twin/zygosity sidecar (NULL if none uploaded, if invalid, or if no pair has both animals in analysisPedigree). Checked against the whole studbook, not the trimmed view: an id that is not in the studbook, or any other failure of checkTwinRelations(), shows an error notification and makes the whole sidecar NULL; a valid pair with an animal outside analysisPedigree (a focal-animal trim) is left out of this value, with no message. Unlike the Diagram tab's own rendering, this is the raw, ungated reactive -- not filtered by the "Show Twin Connectors" toggle -- so callers outside this module (e.g. appServer) see the validated data regardless of that toggle's state (BL-N Slice 3).

Arguments

id

character vector of length 1. Module namespace identifier.

studbook

reactive returning the cleaned studbook data from modInput.

Details

This module processes the studbook by:

  • Adding a population column via setPopulation(): the focal animals, or the living animals when none are entered

  • Adding a pedNum column via findPedigreeNumber()

  • Ensuring a gen column exists via findGeneration()

  • Optionally trimming to the ancestors and descendants of focal animals via trimPedigree() and getDescendantPedigree()

See Also

modPedigreeUI for the UI component

setPopulation for population marking

trimPedigree for pedigree trimming

findPedigreeNumber for pedigree numbering

findGeneration for generation calculation

Other Shiny modules: modBreedingGroupsServer(), modBreedingGroupsUI(), modCrossCenterIdentityServer(), modCrossCenterIdentityUI(), modDeidentifiedExportServer(), modDeidentifiedExportUI(), modGeneticDiversityServer(), modGeneticDiversityUI(), modGeneticValueServer(), modGeneticValueUI(), modGvAndBgDescServer(), modGvAndBgDescUI(), modInputServer(), modInputUI(), modMarkerGeneticsServer(), modMarkerGeneticsUI(), modMatePairServer(), modMatePairUI(), modORIPReportingServer(), modORIPReportingUI(), modPedigreeUI(), modPotentialParentsServer(), modPotentialParentsUI(), modPyramidServer(), modPyramidUI(), modSnapshotTrendsServer(), modSnapshotTrendsUI(), modSummaryStatsServer(), modSummaryStatsUI()