| splitped | R Documentation |
Detects and splits a tidyped object into disconnected groups (connected components). Uses igraph to efficiently find groups of individuals that have no genetic relationships with each other. Isolated individuals (Gen = 0, those with no parents and no offspring) are excluded from group splitting and stored separately.
splitped(ped)
ped |
A tidyped object created by |
This function identifies connected components in the pedigree graph where edges represent parent-offspring relationships. Two individuals are in the same group if they share any ancestry (direct or indirect).
Isolated individuals (Gen = 0 in tidyped output) are those who:
Have no known parents (Sire and Dam are both NA)
Are not parents of any other individual in the pedigree
These isolated individuals are excluded from splitting and stored in the
isolated attribute. Each resulting group contains at least 2 individuals
(at least one parent-offspring relationship).
The function always returns a list, even if there is only one group (i.e., the pedigree is fully connected). Groups are sorted by size in descending order.
Each group in the result is a valid tidyped object with:
Renumbered IndNum (1 to n for each group)
Updated SireNum and DamNum referencing the new IndNum
Recalculated Gen (generation) based on the group's structure
A list of class "splitped" containing:
GP1, GP2, ... |
tidyped objects for each disconnected group (with at least 2 individuals), with renumbered IndNum, SireNum, DamNum |
The returned object has the following attributes:
n_groups |
Number of disconnected groups found (excluding isolated individuals) |
sizes |
Named vector of group sizes |
total |
Total number of individuals in groups (excluding isolated) |
isolated |
Character vector of isolated individual IDs (Gen = 0) |
n_isolated |
Number of isolated individuals |
tidyped for pedigree tidying
# Load example data
library(visPedigree)
data(small_ped)
# First tidy the pedigree
tped <- tidyped(small_ped)
# Split into groups
result <- splitped(tped)
print(result)
# Access individual groups (each is a tidyped object)
result$GP1
# Check isolated individuals
attr(result, "isolated")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.