From e902bf4e9a57aec0d1f9e88bed36252134a5773a Mon Sep 17 00:00:00 2001 From: Karan Jaisingh Date: Mon, 6 Jan 2025 11:55:46 -0500 Subject: [PATCH] Fix bug that results in an empty Vapor report (#754) * Initial commit * Conditionally get dict fields if they exist --- .../src/sv_utils/report_confident_irs_vapor_variants.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sv_utils/src/sv_utils/report_confident_irs_vapor_variants.py b/src/sv_utils/src/sv_utils/report_confident_irs_vapor_variants.py index e5a2aab69..d40ed5c82 100755 --- a/src/sv_utils/src/sv_utils/report_confident_irs_vapor_variants.py +++ b/src/sv_utils/src/sv_utils/report_confident_irs_vapor_variants.py @@ -223,7 +223,8 @@ def main(argv: Optional[List[Text]] = None) -> get_truth_overlap.ConfidentVarian vapor_support_old = vapor_rec['p_non_ref_old'] > 1 - arguments.vapor_min_precision vapor_support_genotyped = vapor_rec['p_non_ref_genotyped'] > 1 - arguments.vapor_min_precision vapor_support_read_threshold = vapor_rec['p_non_ref_read_threshold'] > 1 - arguments.vapor_min_precision - if vapor_support_old or vapor_support_genotyped or vapor_support_read_threshold: + vapor_support = vapor_support_old or vapor_support_genotyped or vapor_support_read_threshold + if vapor_support: vapor_support_gt = vapor_rec[genomics_io.Keys.gt] vapor_support_gq = vapor_rec[genomics_io.Keys.gq] vapor_support_reads = vapor_rec[genomics_io.Keys.vapor_read_scores] @@ -259,9 +260,9 @@ def main(argv: Optional[List[Text]] = None) -> get_truth_overlap.ConfidentVarian sample, record.info['SVTYPE'], record.info['SVLEN'], - record.samples[sample]['GT'][0], - record.samples[sample]['GT'][1], - record.samples[sample]['GQ'], + record.samples[sample].get('GT', ['N/A', 'N/A'])[0], + record.samples[sample].get('GT', ['N/A', 'N/A'])[1], + record.samples[sample].get('GQ', 'N/A'), vapor_support_gt, vapor_support_gq, vapor_support_reads,