mhc_allele_name_to_regex: Convert an 'mhc_allele_name' to a regular expression to...

View source: R/mhc_allele_name_to_regex.R

mhc_allele_name_to_regexR Documentation

Convert an mhc_allele_name to a regular expression to detect it

Description

Convert an mhc_allele_name to a regular expression to detect it

Usage

mhc_allele_name_to_regex(mhc_allele_name)

Arguments

mhc_allele_name

name of an MHC allele

Value

the regular expression to detect that mhc_allele_name

Author(s)

Richèl J.C. Bilderbeek

Examples

mhc_allele_name <- "HLA-DRB*01:01"
mhc_allele_name_regex <- mhc_allele_name_to_regex(mhc_allele_name)

# Can detect the regex
stringr::str_detect(
  string = "HLA-DRB*01:01",
  pattern = mhc_allele_name_regex
)

# Will not detect a match to the regex
stringr::str_detect(
  string = "HLA-DRB.01:01", # replaced asterisk by dot
  pattern = mhc_allele_name_regex
)

richelbilderbeek/iedbr documentation built on Aug. 21, 2022, 12:12 a.m.