Skip to contents

reduce_to_field2() is a thin wrapper around the ard.redux() method (Reduction Type 'lgx' or 'U2') of the py-ard Python package.

Usage

reduce_to_field2(ard, allele, mode = c("U2", "lgx"))

Arguments

ard

The Python database connection object created by db_initialize()

allele

A string or character vector with (an) HLA allele(s).

mode

Reduction mode. "U2" (default) performs an unambiguous reduction to the equivalent two-field allele. "lgx" reduces to the first allele in the group of alleles (often indicated with "g" notation) that is identical to the input allele in the antigen recognition domain (ARD).

Value

A string or character vector of the same length as allele, with the corresponding two-field alleles.

Details

Uses the IPD-IMGT/HLA database as initialized with db_initialize(). This function will throw an error if any of the alleles in the input do not exist in the database. Use is_in_ipd_db() to safely check if the allele(s) exist(s).

See also

reduce_to_serology() to reduce an allele to serological equivalents

Examples

if (FALSE) { # \dontrun{
ard <- db_initialize(data_dir = path.expand("~/ipd_db"))
reduce_to_field2(ard, "DQB1*02:02:01")
#> "DQB1*02:02"
reduce_to_field2(ard, "A*01:04:01:01N")
#> "A*01:04N"
# Some alleles return a different result depending on the reduction mode:
reduce_to_field2(ard, "C*07:06", mode = "U2")
#> "C*07:06"
reduce_to_field2(ard, "C*07:06", mode = "lgx")
#> "C*07:01"
# N.B. serology can also be "reduced", but might lead to a long genotype:
reduce_to_field2(ard, "Cw10")
#> "C*03:02/C*03:04Q/C*03:04/C*03:06/C*03:26/C*03:28/C*03:46"
# Also works for vectors:
reduce_to_field2(ard, c("A*01:01:01:01", "A*24:02:01:01"))
#> "A*01:01" "A*24:02"
} # }