k96nb01 / immunogenetr_package

0 stars 0 forks source link

Correct GL strings for HLA_mismatch_alleles_HvG #2

Closed k96nb01 closed 2 months ago

k96nb01 commented 3 months ago

HLA_mismatch_alleles_HvG does not output proper GL strings for more than one mismatch per locus. Take the following code:

GL_string_donor <- "HLA-A*03:01+HLA-A*30:01^HLA-C*07:02+HLA-C*12:03^HLA-B*07:02+HLA-B*38:01^HLA-DRB3*01:01^HLA-DRB5*01:01^HLA-DRB1*03:01+HLA-DRB1*15:01^HLA-DQA1*01:02+HLA-DQA1*05:01^HLA-DQB1*02:01+HLA-DQB1*06:02^HLA-DPA1*01:03+HLA-DPA1*01:03^HLA-DPB1*04:01+HLA-DPB1*04:01"
locus <- c("A", "B", "C", "DRB1")
HLA_mismatch_alleles_HvG(GL_string_recip, GL_string_donor, locus) 

Gives this output:

"HLA-A*03:01^HLA-A*30:01^HLA-B*07:02^HLA-B*38:01^HLA-C*07:02^HLA-C*12:03^HLA-DRB1*03:01^HLA-DRB1*15:01"

Alleles of the same locus should be separated, like this (with + for the same locus, and ^ between loci):

"HLA-A*03:01+HLA-A*30:01^HLA-B*07:02+HLA-B*38:01^HLA-C*07:02+HLA-C*12:03^HLA-DRB1*03:01+HLA-DRB1*15:01"