Learn R Programming

nprcgenekeepr (version 3.0.0)

checkMarkerGenotypeFile: Check a long-format multi-locus marker genotype file

Description

Validates the structure and legal domain of a long-format marker genotype table (one row per id x locus), the input format for the marker-based (KING-robust) kinship estimator (markerKinship). This is a new, sibling schema to the single-locus first_name/second_name genotype format checked by checkGenotypeFile -- that function, and everything downstream of it (addGenotype, geneDrop), is untouched by this one.

Usage

checkMarkerGenotypeFile(genotype)

Value

The genotype dataframe, checked to ensure the column count, first-column identity, per-locus allele count, 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

The KING-robust kinship estimator (Manichaikul et al. 2010) is defined for biallelic markers only -- every genotype is classified as homozygous-reference, heterozygous, or homozygous-alternate, with no representation for a third allele at a locus. A locus with more than two distinct alleles observed anywhere in the input is therefore rejected outright, rather than silently producing an uninterpretable kinship estimate.

References

Manichaikul, A., Mychaleckyj, J. C., Rich, S. S., Daly, K., Sale, M., & Chen, W.-M. (2010). Robust relationship inference in genome-wide association studies. Bioinformatics, 26(22), 2867-2873. tools:::Rd_expr_doi("10.1093/bioinformatics/btq559")

See Also

buildMarkerGenotypeMatrix, markerKinship

Examples

Run this code
library(nprcgenekeepr)
markerGenotype <- data.frame(
  id = c("A", "A", "B", "B"),
  locus = c("L1", "L2", "L1", "L2"),
  allele1 = c("A", "A", "A", "A"),
  allele2 = c("A", "B", "B", "B"),
  stringsAsFactors = FALSE
)
checkMarkerGenotypeFile(markerGenotype)

Run the code above in your browser using DataLab