From ce98aca6e86ffb1c98c3a0f2cb2b43684c9d29d8 Mon Sep 17 00:00:00 2001 From: arnikz Date: Wed, 2 Dec 2020 22:59:41 +0100 Subject: [PATCH] Fix: error handling of SV types #77. --- scripts/genome_wide/functions.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/genome_wide/functions.py b/scripts/genome_wide/functions.py index 5932c397..4c4e69d3 100644 --- a/scripts/genome_wide/functions.py +++ b/scripts/genome_wide/functions.py @@ -427,6 +427,7 @@ def get_filepath(vec_type): logging.info('Loading SR positions') + total_reads_coord_min_support = [] chrlist = get_chr_list() chr_list = chrlist # if sampleName != 'T1' else ['17'] @@ -438,20 +439,19 @@ def get_filepath(vec_type): left_clipped_pos_cnt, right_clipped_pos_cnt = json.loads( fin.read().decode('utf-8')) - if svtype == 'DEL': - total_reads_coord_min_support = total_reads_coord_min_support_json['DEL'] + \ - total_reads_coord_min_support_json['INDEL_DEL'] - elif svtype == 'INS': - total_reads_coord_min_support = total_reads_coord_min_support_json['INS'] + \ - total_reads_coord_min_support_json['INDEL_INS'] - else: - total_reads_coord_min_support = total_reads_coord_min_support_json[ - svtype] + if svtype in total_reads_coord_min_support_json: + if svtype in ('DEL', 'INDEL_DEL'): + total_reads_coord_min_support = total_reads_coord_min_support_json['DEL'] + \ + total_reads_coord_min_support_json['INDEL_DEL'] + elif svtype in ('INS', 'INDEL_INS'): + total_reads_coord_min_support = total_reads_coord_min_support_json['INS'] + \ + total_reads_coord_min_support_json['INDEL_INS'] + else: + total_reads_coord_min_support = total_reads_coord_min_support_json[svtype] locations_sr = dict() locations_cr_r = dict() locations_cr_l = dict() - positions_cr = dict() for chrom in chr_list: