From 53437291308c420ed8bc26b1169fa5667f95bdd1 Mon Sep 17 00:00:00 2001 From: Christopher Tomkins-Tinch Date: Wed, 10 Apr 2019 17:01:13 -0400 Subject: [PATCH] add guardrails for the case where observed barcodes are null --- util/illumina_indices.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/util/illumina_indices.py b/util/illumina_indices.py index b81643d38..668bb5744 100755 --- a/util/illumina_indices.py +++ b/util/illumina_indices.py @@ -1803,12 +1803,13 @@ def guess_barcodes_for_sample(self, sample_name): out_dict["match_type"] = "high_count_novel_pair" break - out_dict["guessed_barcode_1"] = putative_match[0] - out_dict["guessed_barcode_1_name"] = self.barcode_name_map[putative_match[0]] - if is_dual_index: - out_dict["guessed_barcode_2"] = putative_match[1] - out_dict["guessed_barcode_2_name"] = self.barcode_name_map[putative_match[1]] - out_dict["guessed_barcodes_read_count"] = self.barcodes_seen[(putative_match[0],putative_match[1])] + if putative_match[0]!=None: + out_dict["guessed_barcode_1"] = putative_match[0] + out_dict["guessed_barcode_1_name"] = self.barcode_name_map[putative_match[0]] + if is_dual_index and putative_match[1] != None: + out_dict["guessed_barcode_2"] = putative_match[1] + out_dict["guessed_barcode_2_name"] = self.barcode_name_map[putative_match[1]] + out_dict["guessed_barcodes_read_count"] = self.barcodes_seen[(putative_match[0],putative_match[1])] return out_dict