Skip to content

Commit

Permalink
fix(mi): issues with logger from last refact
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jun 10, 2024
1 parent b0ced24 commit b82e33e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion strkit/mi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions strkit/mi/repeathmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions strkit/mi/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b82e33e

Please sign in to comment.