Skip to content

[Feature]: clinical pedigree styling #98

@smasongarrison

Description

@smasongarrison

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

  1. Decouple status from fill defaults

    • Allow status_column to 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_value or status_fill_when = list(column = "SEP", equals = 1)
    • Behavior example:
      • Unfilled by default for everyone
      • Filled only when SEP == 1
  2. Add a deceased overlay marker

    • Support a parameter such as deceased_column = "DECES" plus styling controls:
      • deceased_value = 1
      • deceased_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.
  3. 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.
  4. 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.
  5. Documentation and example

    • Add a vignette section or example showing exactly this combination:
      • sex shapes + conditional fill (SEP) + deceased cross (DECES) + inclusion outline (INCLUS)
    • Include an example that visually matches typical kinship2 style.

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

Metadata

Metadata

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions