View source: R/getFileDirectRelatives.R
| getFileDirectRelatives | R Documentation |
File-sourced sibling of getLkDirectRelatives: reads a pedigree
file through the internal getPedigreeSource() "file" provider
(via getPedigree), then delegates the pedigree walk to the
source-agnostic getPedDirectRelatives. The result is the full
connected pedigree component (ancestors, descendants, and collaterals such as
siblings and mates) reachable from the focal animals. It is fully offline and
deterministic.
getFileDirectRelatives(
ids,
fileName = NULL,
sep = ",",
unrelatedParents = FALSE
)
ids |
character vector of animal IDs |
fileName |
path to a pedigree file (CSV or Excel) read via
|
sep |
column separator passed to the file reader for delimited text
files (default |
unrelatedParents |
logical vector when |
Unlike the LabKey source, which fails soft (returns NULL) when its
fetch fails, the file source errors loudly: a NULL or missing
fileName, a file that does not exist, or a file lacking the
id, sire, and dam columns each raises an error.
A data.frame with pedigree structure containing all direct relatives – the full connected pedigree component (ancestors, descendants, and collaterals) – for the Ids provided.
Other direct relatives:
getLkDirectAncestors(),
getLkDirectRelatives(),
getPedDirectRelatives()
library(nprcgenekeepr)
## Build a tiny pedigree file, then pull the relatives of a focal animal.
ped <- data.frame(
id = c("A", "B", "C"), sire = c(NA, NA, "A"), dam = c(NA, NA, "B"),
stringsAsFactors = FALSE
)
pedFile <- tempfile(fileext = ".csv")
write.csv(ped, pedFile, row.names = FALSE)
getFileDirectRelatives(ids = "C", fileName = pedFile)
unlink(pedFile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.