Learn R Programming

nprcgenekeepr (version 3.0.0)

checkMhcHaplotypeFile: Check a wide-format MHC haplotype designation file

Description

Validates the structure of a wide per-animal MHC haplotype designation table: exactly three columns -- id plus the animal's two named haplotype designations, one row per animal. This is the explicit input designation for MHC haplotype reporting (issue #148): a curator designates data as MHC by supplying it through this format, and no MHC semantics are ever inferred from locus or column names (the format has no locus names). A new, sibling input family: the long-format marker validators (checkMarkerGenotypeFile, checkLinkageMarkerGenotypeFile, checkSequenceGenotypeFile) and the single-locus checkGenotypeFile path are untouched by this one.

Usage

checkMhcHaplotypeFile(genotype)

Value

The genotype dataframe, checked to ensure the column count, first-column identity, and row uniqueness are all valid. The returned dataframe has its column names forced to c("id", "haplotype1", "haplotype2").

Arguments

genotype

dataframe with wide-format MHC haplotype data: exactly three columns, id, haplotype1, haplotype2 (one row per animal; any column names, see Details).

Details

Column names are not prescribed: the first column must be id-like (case-insensitive match on "id") and is forced to id; the second and third are forced to haplotype1 and haplotype2, so a colony file with, e.g., first_name/second_name headers (the bundled rhesusGenotypes shape) loads unchanged. NA/empty cells pass validation -- a missing call is the statistics layer's concern, not a structural error. A trailing ? on a designation (an uncertain, provisional call) is likewise not validation's business; see the issue #148 design plan's D3 parse rule. Haplotype designations are otherwise opaque labels: never parsed, split, or matched against MHC region names.

See Also

rhesusGenotypes, checkMarkerGenotypeFile

Examples

Run this code
library(nprcgenekeepr)
checked <- checkMhcHaplotypeFile(rhesusGenotypes)
head(checked)

Run the code above in your browser using DataLab