From 064a0fdbfe7f31c8620c4e41d206c051406bc827 Mon Sep 17 00:00:00 2001 From: Xiao Chen Date: Fri, 15 May 2020 16:39:32 -0700 Subject: [PATCH] Fixed --knownFunction function --- caller/construct_star_table.py | 46 ++++++++++++++++++---------------- star_caller.py | 14 ++++++----- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/caller/construct_star_table.py b/caller/construct_star_table.py index 9dc3623..17b15af 100644 --- a/caller/construct_star_table.py +++ b/caller/construct_star_table.py @@ -183,33 +183,37 @@ def get_hap_table(hap_table): dhap_exon9_x2 = {} for star1 in EXON9GC_ALLELES: for star2 in EXON9GC_ALLELES: - for star3 in dstar: - for star4 in dstar: - variant_list = sorted( - dstar[star1].split("_") - + dstar[star2].split("_") - + dstar[star3].split("_") - + dstar[star4].split("_") - ) - star_set = "_".join(sorted([star1, star2, star3, star4])) - make_hap_dic(variant_list, star_set, dhap_exon9_x2) - - # exon9hybx3. limit the search to EXON9GC_ALLELES - dhap_exon9_x3 = {} - for star1 in EXON9GC_ALLELES: - for star2 in EXON9GC_ALLELES: - for star3 in EXON9GC_ALLELES: - for star4 in dstar: - for star5 in dstar: + if star1 in dstar and star2 in dstar: + for star3 in dstar: + for star4 in dstar: variant_list = sorted( dstar[star1].split("_") + dstar[star2].split("_") + dstar[star3].split("_") + dstar[star4].split("_") - + dstar[star5].split("_") ) - star_set = "_".join(sorted([star1, star2, star3, star4, star5])) - make_hap_dic(variant_list, star_set, dhap_exon9_x3) + star_set = "_".join(sorted([star1, star2, star3, star4])) + make_hap_dic(variant_list, star_set, dhap_exon9_x2) + + # exon9hybx3. limit the search to EXON9GC_ALLELES + dhap_exon9_x3 = {} + for star1 in EXON9GC_ALLELES: + for star2 in EXON9GC_ALLELES: + for star3 in EXON9GC_ALLELES: + if star1 in dstar and star2 in dstar and star3 in dstar: + for star4 in dstar: + for star5 in dstar: + variant_list = sorted( + dstar[star1].split("_") + + dstar[star2].split("_") + + dstar[star3].split("_") + + dstar[star4].split("_") + + dstar[star5].split("_") + ) + star_set = "_".join( + sorted([star1, star2, star3, star4, star5]) + ) + make_hap_dic(variant_list, star_set, dhap_exon9_x3) # exon9hybx4. limit the search to *10 and *36 dhap_exon9_x4 = {} diff --git a/star_caller.py b/star_caller.py index 3038d04..57cde33 100644 --- a/star_caller.py +++ b/star_caller.py @@ -246,12 +246,14 @@ def d6_star_caller( ref_read, long_ins_read, short_ins_read = get_allele_counts_42128936( bamfile, call_parameters.genome ) - long_ins_index = var_list.index("g.42128936-42128937insGGGGCGAAAGGGGCGAAA") - short_ins_index = var_list.index("g.42128936-42128937insGGGGCGAAA") - var_alt[long_ins_index] = long_ins_read - var_ref[long_ins_index] = short_ins_read + ref_read - var_alt[short_ins_index] = short_ins_read - var_ref[short_ins_index] = long_ins_read + ref_read + if "g.42128936-42128937insGGGGCGAAAGGGGCGAAA" in var_list: + long_ins_index = var_list.index("g.42128936-42128937insGGGGCGAAAGGGGCGAAA") + var_alt[long_ins_index] = long_ins_read + var_ref[long_ins_index] = short_ins_read + ref_read + if "g.42128936-42128937insGGGGCGAAA" in var_list: + short_ins_index = var_list.index("g.42128936-42128937insGGGGCGAAA") + var_alt[short_ins_index] = short_ins_read + var_ref[short_ins_index] = long_ins_read + ref_read # Variants in homology regions. Get read counts at both D6/D7 positions. var_homo_db = call_parameters.var_homo_db var_homo_alt, var_homo_ref = get_supporting_reads(