pheval 0.4.7__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.

Files changed (33) hide show
  1. pheval/analyse/benchmark.py +156 -0
  2. pheval/analyse/benchmark_db_manager.py +16 -134
  3. pheval/analyse/benchmark_output_type.py +43 -0
  4. pheval/analyse/binary_classification_curves.py +132 -0
  5. pheval/analyse/binary_classification_stats.py +164 -307
  6. pheval/analyse/generate_plots.py +210 -395
  7. pheval/analyse/generate_rank_comparisons.py +44 -0
  8. pheval/analyse/rank_stats.py +190 -382
  9. pheval/analyse/run_data_parser.py +21 -39
  10. pheval/cli.py +27 -24
  11. pheval/cli_pheval_utils.py +7 -8
  12. pheval/post_processing/phenopacket_truth_set.py +235 -0
  13. pheval/post_processing/post_processing.py +185 -337
  14. pheval/post_processing/validate_result_format.py +92 -0
  15. pheval/prepare/update_phenopacket.py +11 -9
  16. pheval/utils/logger.py +35 -0
  17. pheval/utils/phenopacket_utils.py +85 -91
  18. {pheval-0.4.7.dist-info → pheval-0.5.0.dist-info}/METADATA +4 -4
  19. {pheval-0.4.7.dist-info → pheval-0.5.0.dist-info}/RECORD +22 -26
  20. pheval/analyse/analysis.py +0 -104
  21. pheval/analyse/assess_prioritisation_base.py +0 -108
  22. pheval/analyse/benchmark_generator.py +0 -126
  23. pheval/analyse/benchmarking_data.py +0 -25
  24. pheval/analyse/disease_prioritisation_analysis.py +0 -152
  25. pheval/analyse/gene_prioritisation_analysis.py +0 -147
  26. pheval/analyse/generate_summary_outputs.py +0 -105
  27. pheval/analyse/parse_benchmark_summary.py +0 -81
  28. pheval/analyse/parse_corpus.py +0 -219
  29. pheval/analyse/prioritisation_result_types.py +0 -52
  30. pheval/analyse/variant_prioritisation_analysis.py +0 -159
  31. {pheval-0.4.7.dist-info → pheval-0.5.0.dist-info}/LICENSE +0 -0
  32. {pheval-0.4.7.dist-info → pheval-0.5.0.dist-info}/WHEEL +0 -0
  33. {pheval-0.4.7.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
+ )