import glstring
print(glstring.__file__)

from glstring.glstring import *
a = "HLA-A*01:01/HLA-A*01:02+HLA-A*24:02|HLA-A*01:03+HLA-A*24:03^HLA-B*44:01+HLA-B*44:02"
print(a)

"""
Explanation: glstring
using the get_ functions
Each of these functions take a GL String as an argument
End of explanation
"""


get_alleles(a)

get_loci(a)

"""
Explanation: get_alleles() & get_loci()

Each of these functions returns a set of objects.
End of explanation
"""


get_locus_blocks(a) 

"""
Explanation: get_allele_lists(),  get_genotypes(),  get_genotype_lists(), get_locus_blocks(), get_genotype_blocks(), & get_genotype_list_blocks
Each of these functions return a list of objects found in the GL String. 

Locus blocks are separated by a ^.
End of explanation
"""


get_genotype_list_blocks(a)

"""
Explanation: Genotype list blocks are separated by |
End of explanation
"""


get_genotype_blocks(a)

"""
Explanation: Genotype blocks are separated by +
End of explanation
"""


get_genotype_lists(a)

"""
Explanation: Genotype lists are found in locus blocks. The contain | delimiters, which separate the possible genotypes. There is one genotype list in this example.
End of explanation
"""


get_genotypes(a)

"""
Explanation: Genotypes contain a + delimiter and may contain allele lists
End of explanation
"""


get_allele_lists(a)

"""
Explanation: Allele lists contain a / delimiter
End of explanation
"""


a = ("HLA-A*01:01/HLA-A*01:02+HLA-A*24:02|HLA-A*01:03+HLA-A*24:03^"
 "HLA-B*08:01+HLA-B*44:01/HLA-B*44:02^"
 "HLA-C*01:02+HLA-C*01:03^"
 "HLA-DRB5*01:01~HLA-DRB1*03:01+HLA-DRB1*04:07:01/HLA-DRB1*04:92~HLA-DRB1*03:01")
print(a)

get_loci(a)

get_alleles(a)

get_allele_lists(a)

get_genotypes(a)

get_genotype_lists(a)

get_locus_blocks(a)

get_genotypes(get_locus_blocks(a)[0])

get_genotypes(get_locus_blocks(a)[1])

get_allele_lists(get_genotypes(get_locus_blocks(a)[0])[0])

get_alleles(get_allele_lists(get_genotypes(get_locus_blocks(a)[0])[0])[0])

get_haplotypes(a)

"""
Explanation: A more complex example
End of explanation
"""


