#NEWLINE# def compact_allele_name( raw_allele ) : #NEWLINE# #INDENT# '\n    Turn HLA-A*02:01 into A0201 or H-2-D-b into H-2Db or\n    HLA-DPA1*01:05-DPB1*100:01 into DPA10105-DPB110001\n    ' #NEWLINE# parsed_alleles = parse_classi_or_classii_allele_name ( parsed_allele ) #NEWLINE# normalized_list = [ ] #NEWLINE# for parsed_allele in parsed_alleles : #NEWLINE# #INDENT# if ( len ( parsed_allele . allele_family ) > 0 ) : #NEWLINE# #INDENT# normalized_list . append ( ( '%s%s%s' % ( parsed_allele . gene , parsed_allele . allele_family , parsed_allele . allele_code ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# normalized_list . append ( ( '%s%s' % ( parsed_allele . gene , parsed_allele . allele_code ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return '-' . join ( normalized_list )