| pedancestry | R Documentation |
Estimates the proportion of genes for each individual that originates from specific founder groups (e.g., breeds, source populations).
pedancestry(ped, foundervar, target_labels = NULL)
ped |
A |
foundervar |
Character. The name of the column containing founder-group labels (e.g., "Breed", "Origin"). |
target_labels |
Character vector. Specific founder-group labels to track.
If NULL, all unique labels in |
A data.table with columns:
Ind: Individual ID.
One column per tracked label (named after each unique value in
foundervar among founders, or as specified by
target_labels).
Each value gives the proportion of genes (0–1) originating from that
founder group. Row sums across all label columns equal 1.
library(data.table)
# Create dummy labels for founders
tp <- tidyped(small_ped)
tp_dated <- copy(tp)
founders <- tp_dated[is.na(Sire) & is.na(Dam), Ind]
# Assign 'LineA' and 'LineB'
tp_dated[Ind %in% founders[1:(length(founders)/2)], Origin := "LineA"]
tp_dated[is.na(Origin), Origin := "LineB"]
# Calculate ancestry proportions for all individuals
anc <- pedancestry(tp_dated, foundervar = "Origin")
print(tail(anc))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.