Nothing
## Copyright(c) 2017-2026 R. Mark Sharp
## This file is part of nprcgenekeepr
#' Reduce a pedigree to a group and its descendants
#'
#' Filters a pedigree down to only the descendants of the provided group,
#' building the pedigree forward in time starting from a group of probands.
#' This is the downward (descendants-only) mirror of
#' \code{\link{getProbandPedigree}}: it takes the transitive closure over
#' offspring and returns the probands together with all of their descendants.
#' It does not include collateral relatives (siblings, cousins, or mates).
#'
#' @param probands a character vector with the list of animals whose
#' descendants should be included in the final pedigree.
#' @param ped datatable that is the \code{Pedigree}. It contains pedigree
#' information. The fields \code{id}, \code{sire} and \code{dam} are required.
#' @return A reduced pedigree containing the probands and all of their
#' descendants.
#'
#' @export
#' @examples
#' library(nprcgenekeepr)
#' ped <- nprcgenekeepr::lacy1989Ped
#' ## D's descendants are F and G
#' getDescendantPedigree(probands = "D", ped = ped)$id
getDescendantPedigree <- function(probands, ped) {
repeat {
offspring <- getOffspring(ped, probands)
added <- setdiff(offspring, probands)
if (length(added) == 0L) {
break
}
probands <- union(probands, offspring)
}
ped <- ped[ped$id %in% probands, ]
ped
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.