-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Summary
Add first class support in ggpedigree::ggPedigree() for standard clinical pedigree styling so users can independently control (1) sex based shapes, (2) conditional fill for an affected status, (3) a deceased marker overlay, and (4) an independent inclusion highlight color, without these aesthetics overriding each other.
Motivation
Clinical genetics often requires a conventional pedigree layout like kinship2 output, where shape indicates sex, fill indicates affected status only for a specific variable, a death cross overlays the symbol, and an inclusion indicator changes outline color. Right now, providing status_column appears to force fill behavior, some config options for fill are not recognized, and there is no straightforward way to layer a death marker while preserving the desired shape, fill, and outline logic. This blocks users from producing standard clinical pedigrees in ggpedigree without extensive manual ggplot surgery.
Implementation
-
Decouple status from fill defaults
- Allow
status_columnto be used for mapping without automatically filling symbols. - Add an option like:
status_fill_mode = c("none", "always", "conditional")(default"none"to preserve unfilled clinical default when desired)status_fill_valueorstatus_fill_when = list(column = "SEP", equals = 1)
- Behavior example:
- Unfilled by default for everyone
- Filled only when
SEP == 1
- Allow
-
Add a deceased overlay marker
- Support a parameter such as
deceased_column = "DECES"plus styling controls:deceased_value = 1deceased_marker = c("cross", "slash", "x")(default"cross")deceased_marker_size,deceased_marker_color,deceased_marker_stroke
- Implementation detail: render the pedigree symbols normally, then add a second geom layer that draws the cross on top for deceased individuals, so it does not alter the underlying shape, fill, or outline.
- Support a parameter such as
-
Independent outline coloring for inclusion
- Support a parameter such as
outline_color_column = "INCLUS"with:outline_color_when = list(equals = 1, color = "blue")outline_color_else = "black"
- Ensure this outline mapping is independent from affected status mapping, so inclusion does not change fill logic.
- Support a parameter such as
-
Make the above composable
- Ensure shape, fill, deceased overlay, and outline color can all be active simultaneously.
- Provide a single “clinical defaults” preset to match common conventions:
preset = "clinical"- Defaults: square/circle by sex, unfilled, blue outline for included, black otherwise, cross for deceased.
-
Documentation and example
- Add a vignette section or example showing exactly this combination:
- sex shapes + conditional fill (
SEP) + deceased cross (DECES) + inclusion outline (INCLUS)
- sex shapes + conditional fill (
- Include an example that visually matches typical
kinship2style.
- Add a vignette section or example showing exactly this combination:
Additional context
Request originated from a user trying to reproduce a standard clinical pedigree layout (like kinship2) and encountering three blockers: config options not being recognized for status fill control, status_column forcing symbols to be filled with no obvious way to keep them unfilled by default, and inability to add a death cross overlay while preserving the intended shape/fill/outline logic. Desired conventions:
- Shape: square for males, circle for females
- Fill: unfilled by default; filled only when
SEP = 1 - Deceased: cross over symbols when
DECES = 1 - Included: outline colored blue when
INCLUS = 1, otherwise black