R/getIdsWithOneParent.R

Defines functions getIdsWithOneParent

Documented in getIdsWithOneParent

#' getIdsWithOneParent extracts IDs of animals pedigree without either a
#' sire or a dam
## Copyright(c) 2017-2024 R. Mark Sharp
## This file is part of nprcgenekeepr
#'
#' @return Character vector of all single parents
#'
#' @param uPed a trimmed pedigree dataframe with uninformative founders removed.
#' @export
#' @examples
#' examplePedigree <- nprcgenekeepr::examplePedigree
#' breederPed <- qcStudbook(examplePedigree,
#'   minParentAge = 2,
#'   reportChanges = FALSE,
#'   reportErrors = FALSE
#' )
#' probands <- breederPed$id[!(is.na(breederPed$sire) &
#'   is.na(breederPed$dam)) &
#'   is.na(breederPed$exit)]
#' ped <- getProbandPedigree(probands, breederPed)
#' nrow(ped)
#' p <- removeUninformativeFounders(ped)
#' nrow(p)
#' p <- addBackSecondParents(p, ped)
#' nrow(p)
getIdsWithOneParent <- function(uPed) {
  uPed$id[(is.na(uPed$sire) & !is.na(uPed$dam)) |
    (!is.na(uPed$sire) & is.na(uPed$dam))]
}

Try the nprcgenekeepr package in your browser

Any scripts or data that you put into this service are public.

nprcgenekeepr documentation built on June 8, 2025, 10:55 a.m.