pheval 0.4.6__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pheval might be problematic. Click here for more details.
- pheval/analyse/benchmark.py +156 -0
- pheval/analyse/benchmark_db_manager.py +16 -134
- pheval/analyse/benchmark_output_type.py +43 -0
- pheval/analyse/binary_classification_curves.py +132 -0
- pheval/analyse/binary_classification_stats.py +164 -307
- pheval/analyse/generate_plots.py +210 -395
- pheval/analyse/generate_rank_comparisons.py +44 -0
- pheval/analyse/rank_stats.py +190 -382
- pheval/analyse/run_data_parser.py +21 -39
- pheval/cli.py +28 -25
- pheval/cli_pheval_utils.py +7 -8
- pheval/post_processing/phenopacket_truth_set.py +235 -0
- pheval/post_processing/post_processing.py +183 -303
- pheval/post_processing/validate_result_format.py +92 -0
- pheval/prepare/update_phenopacket.py +11 -9
- pheval/utils/logger.py +35 -0
- pheval/utils/phenopacket_utils.py +85 -91
- {pheval-0.4.6.dist-info → pheval-0.5.0.dist-info}/METADATA +4 -4
- {pheval-0.4.6.dist-info → pheval-0.5.0.dist-info}/RECORD +22 -26
- {pheval-0.4.6.dist-info → pheval-0.5.0.dist-info}/WHEEL +1 -1
- pheval/analyse/analysis.py +0 -104
- pheval/analyse/assess_prioritisation_base.py +0 -108
- pheval/analyse/benchmark_generator.py +0 -126
- pheval/analyse/benchmarking_data.py +0 -25
- pheval/analyse/disease_prioritisation_analysis.py +0 -152
- pheval/analyse/gene_prioritisation_analysis.py +0 -147
- pheval/analyse/generate_summary_outputs.py +0 -105
- pheval/analyse/parse_benchmark_summary.py +0 -81
- pheval/analyse/parse_corpus.py +0 -219
- pheval/analyse/prioritisation_result_types.py +0 -52
- pheval/analyse/variant_prioritisation_analysis.py +0 -159
- {pheval-0.4.6.dist-info → pheval-0.5.0.dist-info}/LICENSE +0 -0
- {pheval-0.4.6.dist-info → pheval-0.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from itertools import combinations
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
import polars as pl
|
|
5
|
+
from duckdb.duckdb import DuckDBPyConnection
|
|
6
|
+
|
|
7
|
+
from pheval.analyse.benchmark_db_manager import write_table
|
|
8
|
+
from pheval.analyse.benchmark_output_type import BenchmarkOutputType
|
|
9
|
+
from pheval.utils.logger import get_logger
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def calculate_rank_changes(
|
|
13
|
+
conn: DuckDBPyConnection,
|
|
14
|
+
run_identifiers: List[str],
|
|
15
|
+
true_positive_cases: pl.DataFrame,
|
|
16
|
+
benchmark_type: BenchmarkOutputType,
|
|
17
|
+
) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Calculate rank changes between runs.
|
|
20
|
+
Args:
|
|
21
|
+
conn (DuckDBPyConnection): DuckDB connection.
|
|
22
|
+
run_identifiers (List[str]): List of run identifiers.
|
|
23
|
+
true_positive_cases (pl.LazyFrame): All true positive cases for a benchmark.
|
|
24
|
+
benchmark_type (BenchmarkOutputType): Type of benchmark output.
|
|
25
|
+
"""
|
|
26
|
+
logger = get_logger()
|
|
27
|
+
pairwise_comparisons = list(combinations(run_identifiers, 2))
|
|
28
|
+
for col1, col2 in pairwise_comparisons:
|
|
29
|
+
logger.info(f"Comparing rank changes: {col1} vs. {col2}")
|
|
30
|
+
rank_change_lf = true_positive_cases.with_columns(
|
|
31
|
+
[
|
|
32
|
+
pl.when((pl.col(col1) == 0) & (pl.col(col2) != 0))
|
|
33
|
+
.then(pl.lit("GAINED"))
|
|
34
|
+
.when((pl.col(col1) != 0) & (pl.col(col2) == 0))
|
|
35
|
+
.then(pl.lit("LOST"))
|
|
36
|
+
.otherwise((pl.col(col1) - pl.col(col2)).cast(pl.Int64))
|
|
37
|
+
.alias("rank_change")
|
|
38
|
+
]
|
|
39
|
+
).select(["result_file", *benchmark_type.columns, col1, col2, "rank_change"])
|
|
40
|
+
write_table(
|
|
41
|
+
conn,
|
|
42
|
+
rank_change_lf,
|
|
43
|
+
f"{col1}_vs_{col2}_{benchmark_type.prioritisation_type_string}_rank_changes",
|
|
44
|
+
)
|