def test_macaque_alleles(): allele_name = "Mamu-B*082:02" eq_(normalize_allele_name(allele_name), "Mamu-B*82:02") eq_(compact_allele_name(allele_name), "B8202") # expect 3rd zero in the family "007" to be trimmed in the normalized form # of this allele allele_name = "Mamu-B*007:02" eq_(normalize_allele_name(allele_name), "Mamu-B*07:02") eq_(compact_allele_name(allele_name), "B0702")
def test_mouse_class1_alleles_H2_Db(): # H2-Db eq_(parse_allele_name("H2-Db"), AlleleName("H-2", "D", "", "b")) eq_(normalize_allele_name("H2-Db"), "H-2-Db") eq_(compact_allele_name("H2-Db"), "Db") # with hyphen in "H-2" eq_(parse_allele_name("H-2-Db"), AlleleName("H-2", "D", "", "b")) eq_(normalize_allele_name("H-2-Db"), "H-2-Db") eq_(compact_allele_name("H-2-Db"), "Db")
def test_mouse_class1_alleles_H2_Kk(): # H2-Kk eq_(parse_allele_name("H2-Kk"), AlleleName("H-2", "K", "", "k")) eq_(normalize_allele_name("H2-Kk"), "H-2-Kk") eq_(compact_allele_name("H-2-Kk"), "Kk") # with a hyphen in "H-2" eq_(parse_allele_name("H-2-Kk"), AlleleName("H-2", "K", "", "k")) eq_(normalize_allele_name("H-2-Kk"), "H-2-Kk") eq_(compact_allele_name("H-2-Kk"), "Kk")
def test_mouse_class2_alleles(): # H2-IAb eq_(parse_allele_name("H2-IAb"), AlleleName("H-2", "IA", "", "b")) eq_(normalize_allele_name("H2-IAb"), "H-2-IAb") eq_(compact_allele_name("H2-IAb"), "IAb") # with hyphen in "H-2" eq_(parse_allele_name("H-2-IAb"), AlleleName("H-2", "IA", "", "b")) eq_(normalize_allele_name("H-2-IAb"), "H-2-IAb") eq_(compact_allele_name("H-2-IAb"), "IAb")
def test_human_class2_alpha_beta(): expected = "HLA-DPA1*01:05-DPB1*100:01" expected_compact = "DPA10105-DPB110001" for name in ["DPA10105-DPB110001", "HLA-DPA1*01:05-DPB1*100:01", "hla-dpa1*0105-dpb1*10001", "dpa1*0105-dpb1*10001", "HLA-DPA1*01:05/DPB1*100:01"]: eq_(normalize_allele_name(name), expected) eq_(compact_allele_name(name), expected_compact)
def test_human_class2(): expected = "HLA-DRB1*01:02" expected_compact = "DRB10102" for name in ["DRB1_0102", "DRB101:02", "HLA-DRB1_0102", "DRB10102", "DRB1*0102", "HLA-DRB1*0102", "HLA-DRB1*01:02"]: eq_(normalize_allele_name(name), expected) eq_(compact_allele_name(name), expected_compact)
def test_hla_short_names(): expected = "A0201" for name in hla_02_01_names: result = compact_allele_name(name) eq_(result, expected)