@@ -197,17 +197,20 @@ def redux_gl(self, glstring: str, redux_type: str) -> str:
197197 return self .redux_gl ("/" .join (self .xx_codes [loc_antigen ]), redux_type )
198198
199199 # Handle MAC
200- if self .is_mac (glstring ) and is_valid_mac_code (self .db_connection , code ):
201- if HLA_regex .search (glstring ):
202- # Remove HLA- prefix
203- allele_name = glstring .split ("-" )[1 ]
204- loc_antigen , code = allele_name .split (":" )
205- alleles = self ._get_alleles (code , loc_antigen )
206- alleles = ["HLA-" + a for a in alleles ]
200+ if self .is_mac (glstring ):
201+ if is_valid_mac_code (self .db_connection , code ):
202+ if HLA_regex .search (glstring ):
203+ # Remove HLA- prefix
204+ allele_name = glstring .split ("-" )[1 ]
205+ loc_antigen , code = allele_name .split (":" )
206+ alleles = self ._get_alleles (code , loc_antigen )
207+ alleles = ["HLA-" + a for a in alleles ]
208+ else :
209+ alleles = self ._get_alleles (code , loc_antigen )
210+ return self .redux_gl ("/" .join (alleles ), redux_type )
207211 else :
208- alleles = self ._get_alleles (code , loc_antigen )
209- return self .redux_gl ("/" .join (alleles ), redux_type )
210-
212+ # future: raise ValueError
213+ return ''
211214 return self .redux (glstring , redux_type )
212215
213216 def is_XX (self , glstring : str , loc_antigen : str = None , code : str = None ) -> bool :
@@ -219,8 +222,9 @@ def is_XX(self, glstring: str, loc_antigen: str = None, code: str = None) -> boo
219222 @staticmethod
220223 def is_serology (allele : str ) -> bool :
221224 """
222- A serology has the locus name (first 2 letters for DRB1, DRB3, DQB1, DQA1, DPB1 and DPA1 )
225+ A serology has the locus name (first 2 letters for DRB1, DQB1)
223226 of the allele followed by numerical antigen.
227+ Cw is the serlogical designation for HLA-C
224228
225229 :param allele: The allele to test for serology
226230 :return: True if serology
@@ -229,12 +233,12 @@ def is_serology(allele: str) -> bool:
229233 return False
230234
231235 locus = allele [0 :2 ]
232- if locus in ['DR' , 'DP' , 'DQ' ]:
236+ if locus in ['DR' , 'DP' , 'DQ' , 'Cw' ]:
233237 antigen = allele [2 :]
234238 return antigen .isdigit ()
235239
236240 locus = allele [0 :1 ]
237- if locus in ['A' , 'B' , 'C' , 'D' ]:
241+ if locus in ['A' , 'B' ]:
238242 antigen = allele [1 :]
239243 return antigen .isdigit ()
240244
0 commit comments