From 10fab5ef38f6801e01d0ba3c8fd756e87b7fd9f8 Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Mon, 16 Dec 2024 17:19:22 +0000 Subject: [PATCH] qc/reporting: trap for '10x_reads_per_cell' not being integer in 'SampleQCReporter.get_10x_value()'. --- auto_process_ngs/qc/reporting.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/auto_process_ngs/qc/reporting.py b/auto_process_ngs/qc/reporting.py index d957580fd..f0ea3b1fc 100644 --- a/auto_process_ngs/qc/reporting.py +++ b/auto_process_ngs/qc/reporting.py @@ -2429,7 +2429,14 @@ def get_10x_value(self,field,cellranger_data,metrics,web_summary, # Cellranger 8.0.0 doesn't output median # reads so fall back to mean value = metrics.mean_reads_per_cell - value = pretty_print_reads(value) + try: + # Assume that reads per cell is an + # integer and trap if it isn't (e.g. + # '---') + value = pretty_print_reads(int(value)) + except ValueError: + # Not an integer - report as a string + value = str(value) elif field == "10x_genes_per_cell": value = pretty_print_reads(metrics.median_genes_per_cell) elif field == "10x_frac_reads_in_cell":