pedancestry: Calculate Ancestry Proportions

pedancestryR Documentation

Calculate Ancestry Proportions

Description

Estimates the proportion of genes for each individual that originates from specific founder groups (e.g., breeds, source populations).

Usage

pedancestry(ped, foundervar, target_labels = NULL)

Arguments

ped

A tidyped object.

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 foundervar among founders are used.

Value

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.

Examples


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))



visPedigree documentation built on March 30, 2026, 9:07 a.m.