From 0ba21e686c4802fa2f81a30a44dc637dab21598b Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Thu, 2 Nov 2023 15:41:58 -0400 Subject: [PATCH] fix(mi): handle null genotypes from tandem-genotypes correctly (pt. 2) --- strkit/VERSION | 2 +- strkit/mi/result.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/strkit/VERSION b/strkit/VERSION index b80f98e..1ee43fc 100644 --- a/strkit/VERSION +++ b/strkit/VERSION @@ -1 +1 @@ -0.11.7 +0.11.8 diff --git a/strkit/mi/result.py b/strkit/mi/result.py index 2c0b76f..b3a81cb 100644 --- a/strkit/mi/result.py +++ b/strkit/mi/result.py @@ -222,15 +222,15 @@ def _respects_mi_ci(self, c_gt_ci, m_gt_ci, f_gt_ci, widen: float) -> Optional[b try: m_gt_ci_0 = (m_gt_ci[0][0] - (m_gt_ci[0][0] * widen), m_gt_ci[0][1] + (m_gt_ci[0][1] * widen)) m_gt_ci_1 = (m_gt_ci[1][0] - (m_gt_ci[1][0] * widen), m_gt_ci[1][1] + (m_gt_ci[1][1] * widen)) - except IndexError: - self._logger.error(f"Encountered invalid maternal confidence intervals: {m_gt_ci}") + except (IndexError, TypeError) as e: + self._logger.error(f"Encountered invalid maternal confidence intervals: {m_gt_ci} ({e})") return None try: f_gt_ci_0 = (f_gt_ci[0][0] - (f_gt_ci[0][0] * widen), f_gt_ci[0][1] + (f_gt_ci[0][1] * widen)) f_gt_ci_1 = (f_gt_ci[1][0] - (f_gt_ci[1][0] * widen), f_gt_ci[1][1] + (f_gt_ci[1][1] * widen)) - except IndexError: - self._logger.error(f"Encountered invalid paternal confidence intervals: {f_gt_ci}") + except (IndexError, TypeError) as e: + self._logger.error(f"Encountered invalid paternal confidence intervals: {f_gt_ci} ({e})") return None try: @@ -247,8 +247,8 @@ def _respects_mi_ci(self, c_gt_ci, m_gt_ci, f_gt_ci, widen: float) -> Optional[b (cis_overlap(c_gt_ci[1], m_gt_ci_1) and cis_overlap(c_gt_ci[0], f_gt_ci_0)), (cis_overlap(c_gt_ci[1], m_gt_ci_1) and cis_overlap(c_gt_ci[0], f_gt_ci_1)), )) - except IndexError: - self._logger.error(f"Encountered invalid child confidence intervals: {c_gt_ci}") + except (IndexError, TypeError) as e: + self._logger.error(f"Encountered invalid child confidence intervals: {c_gt_ci} ({e})") return None def respects_mi(self, widen: Optional[float] = None) -> tuple[bool, bool, Optional[bool], Optional[bool]]: