diff --git a/strkit/mi/base.py b/strkit/mi/base.py index b59a9c0..6827ead 100644 --- a/strkit/mi/base.py +++ b/strkit/mi/base.py @@ -173,7 +173,9 @@ def calculate(self, included_contigs: set) -> Optional[MIResult]: self._widen, self.test_to_perform, self.sig_level, - self.mt_corr) + self.mt_corr, + logger=self._logger, + ) if self.test_to_perform != "none": mi_res.correct_for_multiple_testing() # Also calculates new output loci diff --git a/strkit/mi/repeathmm.py b/strkit/mi/repeathmm.py index 3331355..04892ab 100644 --- a/strkit/mi/repeathmm.py +++ b/strkit/mi/repeathmm.py @@ -87,6 +87,8 @@ def calculate_contig(self, contig: str) -> MIContigResult: child_gt=int_tuple(call.split("/")), mother_gt=mother_calls[lookup], father_gt=father_calls[lookup], + + logger=self._logger, )) return cr diff --git a/strkit/mi/result.py b/strkit/mi/result.py index 05b2183..29bcf25 100644 --- a/strkit/mi/result.py +++ b/strkit/mi/result.py @@ -12,7 +12,7 @@ from strkit.constants import CHROMOSOMES from strkit.json import json, dumps_indented -from strkit.logger import logger as logger_ +from strkit.logger import get_main_logger from strkit.utils import cat_strs, cis_overlap from typing import Generator, Iterable, Optional, Union @@ -61,7 +61,7 @@ def __init__( test_to_perform: str = "none", - logger: logging.Logger = logger_, + logger: Optional[logging.Logger] = None, ): self._contig = contig self._start = start @@ -95,7 +95,7 @@ def __init__( if test_to_perform != "none": self._p_value = self.de_novo_test(test_to_perform) - self._logger = logger + self._logger = logger or get_main_logger() @property def contig(self) -> str: @@ -450,13 +450,13 @@ def __init__( test_to_perform: str = "none", sig_level: float = 0.05, mt_corr: str = "none", - logger: logging.Logger = logger_, + logger: Optional[logging.Logger] = None, ): self.mi_value: float = mi_value self.mi_value_pm1: float = mi_value_pm1 self.mi_value_95_ci: Optional[float] = mi_value_95_ci self.mi_value_99_ci: Optional[float] = mi_value_99_ci - self._contig_results: tuple[MIContigResult] = tuple(contig_results) + self._contig_results: tuple[MIContigResult, ...] = tuple(contig_results) self._output_loci: list[MILocusData] = output_loci self.widen: float = widen self._test_to_perform: str = test_to_perform @@ -467,10 +467,10 @@ def __init__( self._seen_loci_lengths: tuple[int, ...] = tuple( itertools.chain.from_iterable(cr.seen_loci_lengths for cr in self.contig_results)) - self._logger: logging.Logger = logger + self._logger: logging.Logger = logger or get_main_logger() @property - def contig_results(self) -> tuple[MIContigResult]: + def contig_results(self) -> tuple[MIContigResult, ...]: return self._contig_results @property