
HLA Genotyping in UKB
ukb_hla_typing.RdParse UK Biobank HLA v2 compound field (22182) and derive per-locus genotypes
Arguments
- df
A data.frame/tibble with
eidand a compound column (defaultp22182).- header
Allele column order, e.g.
ukb_hla_header()(character vector).- col
Compound column name. Default "p22182".
- q_threshold
Posterior threshold (UKB commonly uses 0.7). Default 0.7.
Value
A list with:
calls: data.table with per-allele calls (eid, locus, allele, allele_pretty, allele_copies, allele_q).genotype: data.table with per-locus genotype strings (eid, locus, genotype).
Examples
if (FALSE) { # \dontrun{
library(tidyverse)
# x <- data.table::fread("~/Project/UKB/data/HLA.csv")
# x <- data.table::fread("HLA.csv") # eid + p22182
header <- ukb_hla_header()
res <- ukb_hla_typing(x, header)
res$genotype %>% dplyr::filter(locus == "B") %>% dplyr::slice_head(n = 5)
} # }