Learn R Programming

nprcgenekeepr (version 3.0.0)

readAncestryRules: Read an ancestry compatibility rules table from a file

Description

Reads a center-configurable ancestry compatibility rules table from a user-supplied file into a data frame for checkAncestryRules (issue #168). Each row is one unordered pair of standardized ancestry levels plus the rule's severity: columns ancestry1, ancestry2, and severity ("block" or "flag"), with a header row. Excel (.xls/.xlsx) and delimited text (.csv/.txt) files are both accepted, mirroring readKinshipOverrides.

Usage

readAncestryRules(fileName, sep = ",")

Value

A data frame of the rows read from fileName (typically with columns ancestry1, ancestry2, and severity). Validate it with checkAncestryRules before use.

Arguments

fileName

character vector of length one; path to the rules file (typically the temporary datapath from a Shiny file upload).

sep

column separator for delimited text files (default ",").

Details

This reader does not validate structure or domain -- that is checkAncestryRules's job. An example rules file expressing the rhesus Indian-origin purity case ships as example_ancestry_rules.csv in the package's extdata/examples directory.

Examples

Run this code
rulesFile <- system.file("extdata", "examples",
  "example_ancestry_rules.csv",
  package = "nprcgenekeepr"
)
rules <- checkAncestryRules(readAncestryRules(rulesFile))
rules

Run the code above in your browser using DataLab