Skip to contents

clean_hla() takes in a string or character vector of HLA alleles, and performs a number of cleaning steps to correct common issues with formatting.

Usage

clean_hla(allele)

Arguments

allele

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

Value

A string or character vector of the same length as allele, with the cleaned-up alleles (or the originals, if no cleaning was necessary).

Details

clean_hla() performs the following operations, in this order:

  1. Removes leading or trailing whitespace

  2. Adds a leading zero to fields if necessary (A*1:1 –> A*01:01)

  3. Removes redundant "versions" of the allele (e.g. a broad when the split is also specified). See strip_redundant()

  4. Removes punctuation and symbols that are not part of the notation

  5. Adds an ":XX" suffix to molecular alleles with only 1 field (A*01 –> A*01:XX)

  6. Propagates loci and allele group fields in ambiguities (A*01:01/02 –> A*01:01/A*01:02)

  7. Converts v2 to v3 (A*01010102N –> A*01:01:01:02N). See convert_v2_to_v3()

Examples

clean_hla(" A'*1 ")
#> [1] "A*01:XX"
clean_hla("A25(10)")
#> [1] "A25"
clean_hla("C*03:01/02")
#> [1] "C*03:01/C*03:02"