diff --git a/src/chanjo2/meta/handle_d4.py b/src/chanjo2/meta/handle_d4.py index 393b9305..080cce06 100644 --- a/src/chanjo2/meta/handle_d4.py +++ b/src/chanjo2/meta/handle_d4.py @@ -1,4 +1,3 @@ -import logging import subprocess import tempfile from statistics import mean @@ -18,7 +17,6 @@ TranscriptTag, ) -LOG = logging.getLogger(__name__) CHROM_INDEX = 0 START_INDEX = 1 STOP_INDEX = 2 @@ -90,10 +88,6 @@ def get_report_sample_interval_coverage( ) -> None: """Compute stats to populate a coverage report and coverage overview for one sample.""" - if not intervals_coords: - intervals_coords = [] - completeness_thresholds = [] - # Compute intervals coverage intervals_coverage: List[float] = get_d4tools_intervals_mean_coverage( d4_file_path=d4_file_path, intervals=intervals_coords @@ -154,9 +148,10 @@ def get_report_sample_interval_coverage( interval_ids.add(interval.ensembl_id) for threshold in completeness_thresholds: - completeness_row_dict[f"completeness_{threshold}"] = round( - mean(thresholds_dict[threshold]) * 100, 2 - ) + if thresholds_dict[threshold]: + completeness_row_dict[f"completeness_{threshold}"] = round( + mean(thresholds_dict[threshold]) * 100, 2 + ) report_data["completeness_rows"].append((sample_name, completeness_row_dict)) report_data["incomplete_coverage_rows"] += incomplete_coverages_rows