Skip to content

Commit

Permalink
Report species probe info (#176)
Browse files Browse the repository at this point in the history
* Log species probe coverage info in debug mode

* fix windows build: pythonpath point to 3.11 instead of 3.10
  • Loading branch information
martinghunt authored Aug 3, 2023
1 parent e7f34fb commit 4c52a48
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ jobs:
env:
OUTPUT_TARBALL: mykrobe.command_line.windows.${{env.RELEASE_VERSION}}.tar.gz
run: |
export PYTHONPATH="/mingw64/lib/python3.10/:/mingw64/lib/python3.10/site-packages:${PYTHONPATH}"
export PYTHONPATH="/mingw64/lib/python3.11/:/mingw64/lib/python3.11/site-packages:${PYTHONPATH}"
C:\\msys64\\mingw64\\bin\\python3.exe -m ensurepip --upgrade
C:\\msys64\\mingw64\\bin\\python3.exe -m pip install pyinstaller requests pytest
echo "clone mccortex"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added

- When using `--debug` flag, log species probe coverage/depth info and also each
time a probe is rejected due to low coverage and/or depth.

## [0.12.2]

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions src/mykrobe/metagenomics/phylo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function
import json
import logging
import os
import operator
from mykrobe.utils import median
Expand All @@ -8,6 +9,7 @@
from mykrobe.metagenomics.models import MykrobePredictorPhylogeneticsResult
from mykrobe.stats import percent_coverage_from_expected_coverage

logger = logging.getLogger(__name__)

DEFAULT_THRESHOLD = 30

Expand Down Expand Up @@ -141,8 +143,10 @@ def _aggregate(self, covgs, threshold=5):
_median = covg_dict.get("median", [0])
minimum_percentage_coverage_required = percent_coverage_from_expected_coverage(
self.expected_depth) * self.threshold.get(phylo_group, DEFAULT_THRESHOLD)
logger.debug(f"Probe coverage. probe={phylo_group} percent_covered={total_percent_covered} median_cov={median(_median)}")
if total_percent_covered < minimum_percentage_coverage_required or median(
_median) < 0.1 * self.expected_depth:
logger.debug(f"Probe rejected. probe={phylo_group}, total percent covered={total_percent_covered} < {minimum_percentage_coverage_required}=min required, or median depth={median(_median)} < {round(0.1 * self.expected_depth, 1)} = 10% of expected depth of {self.expected_depth}")
# Remove low coverage nodes
_index = [
i for i,
Expand Down

0 comments on commit 4c52a48

Please sign in to comment.