KIR_haplotype_Cen: KIR Centromeric Haplotype

Description Usage Arguments Value See Also Examples

View source: R/kir.R

Description

Assigns the Centrometic haplotype (A/A, A/B or B/B) given a set of KIRs

Usage

1
2
3
4
5
6
7
KIR_haplotype_Cen(
  df,
  KIR_2DL3col,
  KIR_2DS2col,
  KIR_2DL2col,
  present_cols = FALSE
)

Arguments

df

data.frame with KIR alleles string as columns

KIR_2DL3col

string, name of 2DL3 column

KIR_2DS2col

string, name of 2DS2 column

KIR_2DL2col

string, name of 2DL2 column

present_cols

Default is FALSE which assumes the KIR columns contains the allele string ("001", "NEG" etc), and the presence / absence is calculated inside the function using KIR_present. If set to TRUE, the KIR columns already contain TRUE/FALSE for presence/absence for all KIRs.

Value

string vector with haplotype ("A/A", "A/B", "B/B"), NA if any input KIR is missing, and "unknown" otherwise.

See Also

KIR_haplotype_Tel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dat <- data.frame(kir_2DL3 = c("001", "NEG", NA, "001|002+003"), 
   kir_2DS2 = c("001", "001", "001", "001"), 
   kir_2DL2 = c("NEG", "001", "NEG", "NEG"), 
   stringsAsFactors = FALSE)
KIR_haplotype_Cen(dat, "kir_2DL3", "kir_2DS2", "kir_2DL2")

dat_pres <- data.frame(kir_2DL3 = c(TRUE, FALSE, NA, TRUE), 
   kir_2DS2 = c(TRUE, TRUE, TRUE, TRUE), 
   kir_2DL2 = c(FALSE, TRUE, FALSE, FALSE), 
   stringsAsFactors = FALSE)
KIR_haplotype_Cen(dat_pres, "kir_2DL3", "kir_2DS2", "kir_2DL2", present_cols = TRUE)

bosefalk/CTUtools documentation built on Feb. 4, 2022, 4:10 p.m.