Learn R Programming

nprcgenekeepr (version 3.0.0)

checkLinkageMarkerGenotypeFile: Check a long-format multi-locus marker genotype file, multiallelic-tolerant

Description

Validates the structure of a long-format marker genotype table (one row per id x locus), the same schema checkMarkerGenotypeFile checks -- but, unlike that function, does not require every locus to be biallelic. This is a new, sibling validator for the linkage-aware and haplotype-block metrics family (issue #153): real colony marker panels (e.g. microsatellite/STR panels) are routinely multiallelic, a data shape the KING-robust kinship estimator checked by checkMarkerGenotypeFile cannot represent, but which buildMarkerGenotypeMatrix pivots without error. checkMarkerGenotypeFile itself, and everything downstream of it (markerKinship), is untouched by this function.

Usage

checkLinkageMarkerGenotypeFile(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", "locus", "allele1", "allele2").

Arguments

genotype

dataframe with long-format marker genotype data: exactly four columns, id, locus, allele1, allele2 (one row per individual x locus).

Details

All of checkMarkerGenotypeFile's structural checks are retained -- exactly four columns, id as the first column, no duplicate id x locus rows -- except the per-locus more-than-two-distinct-alleles rejection, which is deliberately omitted.

See Also

checkMarkerGenotypeFile, buildMarkerGenotypeMatrix

Examples

Run this code
library(nprcgenekeepr)
markerGenotype <- data.frame(
  id = c("W", "X", "Y", "Z"),
  locus = c("L1", "L1", "L1", "L1"),
  allele1 = c("A", "A", "A", "A"),
  allele2 = c("B", "C", "A", "D"),
  stringsAsFactors = FALSE
)
checkLinkageMarkerGenotypeFile(markerGenotype)

Run the code above in your browser using DataLab