From a8c9106384f1d1cc23944fd0a0bddce9f6e7bc1f Mon Sep 17 00:00:00 2001 From: Martin Rippin Date: Wed, 10 Jun 2026 09:35:29 +0000 Subject: [PATCH 1/3] fix: add safeguard to avoid ZeroDivisionError --- Script/PRONTO.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Script/PRONTO.py b/Script/PRONTO.py index 11ca11c..d09ea03 100755 --- a/Script/PRONTO.py +++ b/Script/PRONTO.py @@ -745,7 +745,11 @@ def insert_table_to_ppt(table_file,slide_n,table_name,left_h,top_h,width_h,left_ # how many slides are required if not table_max_rows_per_slide: - table_max_rows_per_slide = rows + if rows == 0: + logging.warning("{} is empty".format(table_file)) + return + else: + table_max_rows_per_slide = rows total_slides_needed = math.ceil(rows / table_max_rows_per_slide) # Add data to ppt From 8a0c267412a6a7eafbf06c4af06662d46d4f062d Mon Sep 17 00:00:00 2001 From: Martin Rippin Date: Wed, 10 Jun 2026 09:36:17 +0000 Subject: [PATCH 2/3] fix: avoid unspecific error when file is empty --- Script/PRONTO.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Script/PRONTO.py b/Script/PRONTO.py index d09ea03..81ef209 100755 --- a/Script/PRONTO.py +++ b/Script/PRONTO.py @@ -1355,7 +1355,11 @@ def main(argv): topfilters = pronto.parse_topfilter(cfg, output_file_preMTB_table_path) for filter in topfilters: for filter_column in filter['filter_columns']: - small_variant_data = pandas.read_csv(data_file_small_variant_table, sep='\t', comment='#') + try: + small_variant_data = pandas.read_csv(data_file_small_variant_table, sep='\t', comment='#') + except pandas.errors.EmptyDataError: + logging.warning("{} is empty".format(data_file_small_variant_table)) + sys.exit(1) try: small_variant_data = pronto.filter_small_variant_data(small_variant_data, DNA_sampleID, filter_column, filter['key_word']) except ValueError: From 0df70fc047cb1236a73384afaf3ddf01fbb22e63 Mon Sep 17 00:00:00 2001 From: Martin Rippin Date: Wed, 10 Jun 2026 11:01:29 +0000 Subject: [PATCH 3/3] feat: replace X suffix of protein changes with asterisk --- Script/PRONTO.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Script/PRONTO.py b/Script/PRONTO.py index 81ef209..4b673db 100755 --- a/Script/PRONTO.py +++ b/Script/PRONTO.py @@ -739,6 +739,10 @@ def insert_table_to_ppt(table_file,slide_n,table_name,left_h,top_h,width_h,left_ # round floats to 2 decimal places table_data = pronto.set_column_to_2_decimals(table_data, "AF_tumor_DNA") + # replace X suffix with * + if "Protein_change_short" in table_data.columns: + table_data["Protein_change_short"] = table_data["Protein_change_short"].str.replace(r'X$', '*', regex=True) + # determine column and row number cols = len(table_header) rows = len(table_data)