|
1 | | -# ── Internal helper ─────────────────────────────────────────────────────────── |
2 | | - |
3 | 1 | #' Reduce an ancestor distance matrix to a pairwise generational distance matrix |
4 | 2 | #' |
5 | 3 | #' Given the \code{n x n} ancestor distance matrix returned by |
6 | 4 | #' \code{ped2com(component = "distance")}, computes a pairwise distance matrix |
7 | | -#' \code{D} where \code{D[i, j]} summarises the relationship between individuals |
| 5 | +#' \code{D} where \code{D[i, j]} summarizes the relationship between individuals |
8 | 6 | #' \code{i} and \code{j} through their common ancestors. |
9 | 7 | #' |
10 | 8 | #' For each potential common ancestor column \code{c}, the combined step count |
|
62 | 60 | D[D == -Inf] <- NA_real_ |
63 | 61 |
|
64 | 62 | } else { |
65 | | - # mrca_all — aggregation strategy across ALL common ancestors is |
| 63 | + # mrca_all - aggregation strategy across ALL common ancestors is |
66 | 64 | # domain-specific (sum? mean? something else?). |
67 | 65 | # TODO: define aggregation and replace this stop(). |
68 | 66 | # Options to consider: |
69 | | - # sum(total_steps) — total path weight through every shared ancestor |
70 | | - # mean(total_steps) — average distance across all shared ancestors |
| 67 | + # sum(total_steps) - total path weight through every shared ancestor |
| 68 | + # mean(total_steps) - average distance across all shared ancestors |
71 | 69 | # Your domain knowledge of what "all paths" should mean for pedigree |
72 | 70 | # analysis goes here. For inbred pedigrees this will differ substantially. |
73 | | - stop("mrca_all aggregation not yet implemented — please define the aggregation strategy.") |
| 71 | + stop("mrca_all aggregation not yet implemented - please define the aggregation strategy.") |
74 | 72 | } |
75 | 73 |
|
76 | 74 | D |
77 | 75 | } |
78 | 76 |
|
79 | | -# ── User-facing functions ───────────────────────────────────────────────────── |
80 | | - |
81 | 77 | #' Compute the generational distance between two individuals |
82 | 78 | #' |
83 | 79 | #' @description |
|
96 | 92 | #' (fewest combined steps to reach a shared ancestor).} |
97 | 93 | #' \item{\code{"mrca_max"}}{Total steps via the most distant common ancestor |
98 | 94 | #' (most combined steps to reach a shared ancestor).} |
99 | | -#' \item{\code{"mrca_all"}}{Aggregated distance across all common ancestors |
100 | | -#' — aggregation strategy to be defined.} |
| 95 | +#' \item{\code{"mrca_all"}}{Aggregated distance across all common ancestors} |
101 | 96 | #' } |
102 | 97 | #' @param personID Character. ID column name. Default \code{"ID"}. |
103 | 98 | #' @param momID Character. Mother ID column name. Default \code{"momID"}. |
|
0 commit comments