Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement handling of empty results #228

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/pheval/post_processing/post_processing.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import logging
import operator
from dataclasses import dataclass
from enum import Enum
from pathlib import Path

import pandas as pd

info_log = logging.getLogger("info")


def calculate_end_pos(variant_start: int, variant_ref: str) -> int:
"""Calculate the end position for a variant
Expand Down Expand Up @@ -179,7 +182,6 @@ class SortOrder(Enum):


class ResultSorter:

"""Class for sorting PhEvalResult instances based on a given sort order."""

def __init__(self, pheval_results: [PhEvalResult], sort_order: SortOrder):
Expand Down Expand Up @@ -449,6 +451,9 @@ def generate_pheval_result(
Raises:
ValueError: If the results are not all the same type or an error occurs during file writing.
"""
if not pheval_result:
info_log.warning(f"No results found for {tool_result_path.name}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this log an error, not a warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn’t sure. I can change it to log an error but I didn’t to begin with because sometimes the tool doesn’t generate results and there isn’t an error with the tool itself

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

pass
ranked_pheval_result = _create_pheval_result(pheval_result, sort_order_str)
if all(isinstance(result, RankedPhEvalGeneResult) for result in ranked_pheval_result):
_write_pheval_gene_result(ranked_pheval_result, output_dir, tool_result_path)
Expand Down