diff --git a/caller/match_star_allele.py b/caller/match_star_allele.py index d866db2..90d26dd 100644 --- a/caller/match_star_allele.py +++ b/caller/match_star_allele.py @@ -227,10 +227,14 @@ def get_final_call_clean(final_call, cnvcall, spacer_cn): return "*13/" + split_call[0] return None if cnvcall == "dup_star13intron1": - if split_call.count("*2") >= 2: - split_call.remove("*2") - split_call.remove("*2") - return "*13+*2/" + split_call[0] + unique_stars = list(set(split_call)) + if len(unique_stars) == 2: + if split_call.count(unique_stars[0]) == 2: + return "*13+" + unique_stars[0] + "/" + unique_stars[1] + elif split_call.count(unique_stars[1]) == 2: + return "*13+" + unique_stars[1] + "/" + unique_stars[0] + elif len(unique_stars) == 1: + return "*13+" + unique_stars[0] + "/" + unique_stars[0] return None if cnvcall == "dup_star13": if spacer_cn is not None and spacer_cn == 1: diff --git a/caller/tests/test_match_star.py b/caller/tests/test_match_star.py index e361cd4..9bdc222 100644 --- a/caller/tests/test_match_star.py +++ b/caller/tests/test_match_star.py @@ -130,6 +130,16 @@ def test_clean_call(self): clean_call = get_final_call_clean(final_call, cnvcall, spacer_cn) assert clean_call == "*13+*2/*1" + cnvcall = "dup_star13intron1" + final_call = ["*9_*4_*4"] + clean_call = get_final_call_clean(final_call, cnvcall, spacer_cn) + assert clean_call == "*13+*4/*9" + + cnvcall = "dup_star13intron1" + final_call = ["*4_*4_*4"] + clean_call = get_final_call_clean(final_call, cnvcall, spacer_cn) + assert clean_call == "*13+*4/*4" + cnvcall = "dup_star13" final_call = ["*1_*2"] spacer_cn = None