From 6bdfb07e2f3d065834b4fdf47861af44569e2897 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Tue, 10 Dec 2024 10:20:03 -0500 Subject: [PATCH] chore(mi): log all MI values progressively --- strkit/mi/base.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/strkit/mi/base.py b/strkit/mi/base.py index 6aa889c..b399ae6 100644 --- a/strkit/mi/base.py +++ b/strkit/mi/base.py @@ -210,11 +210,24 @@ def calculate(self, included_contigs: set) -> Optional[MIResult]: n_total += len(contig_result) output_loci.extend(nm) - self._logger.info( - "Finished processing contig %s. Current value: %.2f, ±1: %.2f, n_total: %d", - contig_result.contig, res / n_total * 100, res_pm1 / n_total * 100, n_total, + logger_fmt = "Finished processing contig %s; n_total=%d. Current value: %.2f%%, ±1: %.2f%%" + logger_args = [contig_result.contig, n_total, res / n_total * 100, res_pm1 / n_total * 100] + + extras = ( + (res_95_ci, "95% CI"), + (res_99_ci, "99% CI"), + (res_seq, "seq"), + (res_sl, "s.l."), + (res_sl_pm1, "s.l.±1"), ) + for val, fmt_txt in extras: + if val is not None: + logger_fmt += f", {fmt_txt}: %.2f%%" + logger_args.append(val / n_total * 100) + + self._logger.info(logger_fmt, *logger_args) + if n_total == 0: self._logger.warning("No common loci found") return None