% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pedanalysis.R
\name{pedancestry}
\alias{pedancestry}
\title{Calculate Ancestry Proportions}
\usage{
pedancestry(ped, foundervar, target_labels = NULL)
}
\arguments{
\item{ped}{A \code{tidyped} object.}

\item{foundervar}{Character. The name of the column containing founder-group
labels (e.g., "Breed", "Origin").}

\item{target_labels}{Character vector. Specific founder-group labels to track.
If NULL, all unique labels in \code{foundervar} among founders are used.}
}
\value{
A \code{data.table} with columns:
\itemize{
  \item \code{Ind}: Individual ID.
  \item One column per tracked label (named after each unique value in
    \code{foundervar} among founders, or as specified by
    \code{target_labels}).
    Each value gives the proportion of genes (0--1) originating from that
    founder group. Row sums across all label columns equal 1.
}
}
\description{
Estimates the proportion of genes for each individual that originates from 
specific founder groups (e.g., breeds, source populations).
}
\examples{
\donttest{
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))
}

}
