pheval 0.3.6__py3-none-any.whl → 0.3.7__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.

@@ -10,11 +10,7 @@ from pheval.analyse.prioritisation_result_types import DiseasePrioritisationResu
10
10
  from pheval.analyse.rank_stats import RankStats
11
11
  from pheval.analyse.run_data_parser import TrackInputOutputDirectories
12
12
  from pheval.post_processing.post_processing import RankedPhEvalDiseaseResult
13
- from pheval.utils.file_utils import (
14
- all_files,
15
- files_with_suffix,
16
- obtain_phenopacket_path_from_pheval_result,
17
- )
13
+ from pheval.utils.file_utils import all_files
18
14
  from pheval.utils.phenopacket_utils import PhenopacketUtil, ProbandDisease, phenopacket_reader
19
15
 
20
16
 
@@ -217,7 +213,7 @@ def _obtain_causative_diseases(phenopacket_path: Path) -> List[ProbandDisease]:
217
213
 
218
214
 
219
215
  def assess_phenopacket_disease_prioritisation(
220
- standardised_disease_result: Path,
216
+ phenopacket_path: Path,
221
217
  score_order: str,
222
218
  results_dir_and_input: TrackInputOutputDirectories,
223
219
  threshold: float,
@@ -230,7 +226,7 @@ def assess_phenopacket_disease_prioritisation(
230
226
  against the recorded causative diseases for a proband in the Phenopacket.
231
227
 
232
228
  Args:
233
- standardised_disease_result (Path): Path to the PhEval standardised disease result file.
229
+ phenopacket_path (Path): Path to the Phenopacket.
234
230
  score_order (str): The order in which scores are arranged, either ascending or descending.
235
231
  results_dir_and_input (TrackInputOutputDirectories): Input and output directories.
236
232
  threshold (float): Threshold for assessment.
@@ -238,8 +234,8 @@ def assess_phenopacket_disease_prioritisation(
238
234
  disease_rank_comparison (defaultdict): Default dictionary for disease rank comparisons.
239
235
  disease_binary_classification_stats (BinaryClassificationStats): BinaryClassificationStats class instance.
240
236
  """
241
- phenopacket_path = obtain_phenopacket_path_from_pheval_result(
242
- standardised_disease_result, all_files(results_dir_and_input.phenopacket_dir)
237
+ standardised_disease_result = results_dir_and_input.results_dir.joinpath(
238
+ f"pheval_disease_results/{phenopacket_path.stem}-pheval_disease_result.tsv"
243
239
  )
244
240
  pheval_disease_result = read_standardised_result(standardised_disease_result)
245
241
  proband_diseases = _obtain_causative_diseases(phenopacket_path)
@@ -276,12 +272,9 @@ def benchmark_disease_prioritisation(
276
272
  """
277
273
  disease_rank_stats = RankStats()
278
274
  disease_binary_classification_stats = BinaryClassificationStats()
279
- for standardised_result in files_with_suffix(
280
- results_directory_and_input.results_dir.joinpath("pheval_disease_results/"),
281
- ".tsv",
282
- ):
275
+ for phenopacket_path in all_files(results_directory_and_input.phenopacket_dir):
283
276
  assess_phenopacket_disease_prioritisation(
284
- standardised_result,
277
+ phenopacket_path,
285
278
  score_order,
286
279
  results_directory_and_input,
287
280
  threshold,
@@ -10,11 +10,7 @@ from pheval.analyse.prioritisation_result_types import GenePrioritisationResult
10
10
  from pheval.analyse.rank_stats import RankStats
11
11
  from pheval.analyse.run_data_parser import TrackInputOutputDirectories
12
12
  from pheval.post_processing.post_processing import RankedPhEvalGeneResult
13
- from pheval.utils.file_utils import (
14
- all_files,
15
- files_with_suffix,
16
- obtain_phenopacket_path_from_pheval_result,
17
- )
13
+ from pheval.utils.file_utils import all_files
18
14
  from pheval.utils.phenopacket_utils import PhenopacketUtil, ProbandCausativeGene, phenopacket_reader
19
15
 
20
16
 
@@ -209,7 +205,7 @@ def _obtain_causative_genes(phenopacket_path: Path) -> List[ProbandCausativeGene
209
205
 
210
206
 
211
207
  def assess_phenopacket_gene_prioritisation(
212
- standardised_gene_result: Path,
208
+ phenopacket_path: Path,
213
209
  score_order: str,
214
210
  results_dir_and_input: TrackInputOutputDirectories,
215
211
  threshold: float,
@@ -222,7 +218,7 @@ def assess_phenopacket_gene_prioritisation(
222
218
  against the recorded causative genes for a proband in the Phenopacket.
223
219
 
224
220
  Args:
225
- standardised_gene_result (Path): Path to the PhEval standardised gene result file.
221
+ phenopacket_path (Path): Path to the Phenopacket.
226
222
  score_order (str): The order in which scores are arranged, either ascending or descending.
227
223
  results_dir_and_input (TrackInputOutputDirectories): Input and output directories.
228
224
  threshold (float): Threshold for assessment.
@@ -230,8 +226,8 @@ def assess_phenopacket_gene_prioritisation(
230
226
  gene_rank_comparison (defaultdict): Default dictionary for gene rank comparisons.
231
227
  gene_binary_classification_stats (BinaryClassificationStats): BinaryClassificationStats class instance.
232
228
  """
233
- phenopacket_path = obtain_phenopacket_path_from_pheval_result(
234
- standardised_gene_result, all_files(results_dir_and_input.phenopacket_dir)
229
+ standardised_gene_result = results_dir_and_input.results_dir.joinpath(
230
+ f"pheval_gene_results/{phenopacket_path.stem}-pheval_gene_result.tsv"
235
231
  )
236
232
  pheval_gene_result = read_standardised_result(standardised_gene_result)
237
233
  proband_causative_genes = _obtain_causative_genes(phenopacket_path)
@@ -266,11 +262,9 @@ def benchmark_gene_prioritisation(
266
262
  """
267
263
  gene_rank_stats = RankStats()
268
264
  gene_binary_classification_stats = BinaryClassificationStats()
269
- for standardised_result in files_with_suffix(
270
- results_directory_and_input.results_dir.joinpath("pheval_gene_results/"), ".tsv"
271
- ):
265
+ for phenopacket_path in all_files(results_directory_and_input.phenopacket_dir):
272
266
  assess_phenopacket_gene_prioritisation(
273
- standardised_result,
267
+ phenopacket_path,
274
268
  score_order,
275
269
  results_directory_and_input,
276
270
  threshold,
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  from pathlib import Path
2
3
  from typing import List
3
4
 
@@ -5,6 +6,8 @@ import pandas as pd
5
6
 
6
7
  from pheval.post_processing.post_processing import PhEvalResult
7
8
 
9
+ info_log = logging.getLogger("info")
10
+
8
11
 
9
12
  def read_standardised_result(standardised_result_path: Path) -> List[dict]:
10
13
  """
@@ -16,7 +19,11 @@ def read_standardised_result(standardised_result_path: Path) -> List[dict]:
16
19
  Returns:
17
20
  List[dict]: A list of dictionaries representing the content of the standardised result file.
18
21
  """
19
- return pd.read_csv(standardised_result_path, delimiter="\t").to_dict("records")
22
+ if standardised_result_path.is_file():
23
+ return pd.read_csv(standardised_result_path, delimiter="\t").to_dict("records")
24
+ else:
25
+ info_log.info(f"Could not find {standardised_result_path}")
26
+ return pd.DataFrame().to_dict("records")
20
27
 
21
28
 
22
29
  def parse_pheval_result(
@@ -10,11 +10,7 @@ from pheval.analyse.prioritisation_result_types import VariantPrioritisationResu
10
10
  from pheval.analyse.rank_stats import RankStats
11
11
  from pheval.analyse.run_data_parser import TrackInputOutputDirectories
12
12
  from pheval.post_processing.post_processing import RankedPhEvalVariantResult
13
- from pheval.utils.file_utils import (
14
- all_files,
15
- files_with_suffix,
16
- obtain_phenopacket_path_from_pheval_result,
17
- )
13
+ from pheval.utils.file_utils import all_files
18
14
  from pheval.utils.phenopacket_utils import GenomicVariant, PhenopacketUtil, phenopacket_reader
19
15
 
20
16
 
@@ -211,7 +207,7 @@ def _obtain_causative_variants(phenopacket_path: Path) -> List[GenomicVariant]:
211
207
 
212
208
 
213
209
  def assess_phenopacket_variant_prioritisation(
214
- standardised_variant_result: Path,
210
+ phenopacket_path: Path,
215
211
  score_order: str,
216
212
  results_dir_and_input: TrackInputOutputDirectories,
217
213
  threshold: float,
@@ -224,7 +220,7 @@ def assess_phenopacket_variant_prioritisation(
224
220
  against the recorded causative variants for a proband in the Phenopacket.
225
221
 
226
222
  Args:
227
- standardised_variant_result (Path): Path to the PhEval standardised variant result file.
223
+ phenopacket_path (Path): Path to the Phenopacket.
228
224
  score_order (str): The order in which scores are arranged, either ascending or descending.
229
225
  results_dir_and_input (TrackInputOutputDirectories): Input and output directories.
230
226
  threshold (float): Threshold for assessment.
@@ -232,10 +228,10 @@ def assess_phenopacket_variant_prioritisation(
232
228
  variant_rank_comparison (defaultdict): Default dictionary for variant rank comparisons.
233
229
  variant_binary_classification_stats (BinaryClassificationStats): BinaryClassificationStats class instance.
234
230
  """
235
- phenopacket_path = obtain_phenopacket_path_from_pheval_result(
236
- standardised_variant_result, all_files(results_dir_and_input.phenopacket_dir)
237
- )
238
231
  proband_causative_variants = _obtain_causative_variants(phenopacket_path)
232
+ standardised_variant_result = results_dir_and_input.results_dir.joinpath(
233
+ f"pheval_variant_results/{phenopacket_path.stem}-pheval_variant_result.tsv"
234
+ )
239
235
  pheval_variant_result = read_standardised_result(standardised_variant_result)
240
236
  AssessVariantPrioritisation(
241
237
  phenopacket_path,
@@ -270,12 +266,9 @@ def benchmark_variant_prioritisation(
270
266
  """
271
267
  variant_rank_stats = RankStats()
272
268
  variant_binary_classification_stats = BinaryClassificationStats()
273
- for standardised_result in files_with_suffix(
274
- results_directory_and_input.results_dir.joinpath("pheval_variant_results/"),
275
- ".tsv",
276
- ):
269
+ for phenopacket_path in all_files(results_directory_and_input.phenopacket_dir):
277
270
  assess_phenopacket_variant_prioritisation(
278
- standardised_result,
271
+ phenopacket_path,
279
272
  score_order,
280
273
  results_directory_and_input,
281
274
  threshold,
@@ -375,11 +375,11 @@ def generate_pheval_result(
375
375
  info_log.warning(f"No results found for {tool_result_path.name}")
376
376
  return
377
377
  ranked_pheval_result = _create_pheval_result(pheval_result, sort_order_str)
378
- if all(isinstance(result, RankedPhEvalGeneResult) for result in ranked_pheval_result):
378
+ if all(isinstance(result, PhEvalGeneResult) for result in pheval_result):
379
379
  _write_pheval_gene_result(ranked_pheval_result, output_dir, tool_result_path)
380
- elif all(isinstance(result, RankedPhEvalVariantResult) for result in ranked_pheval_result):
380
+ elif all(isinstance(result, PhEvalVariantResult) for result in pheval_result):
381
381
  _write_pheval_variant_result(ranked_pheval_result, output_dir, tool_result_path)
382
- elif all(isinstance(result, RankedPhEvalDiseaseResult) for result in ranked_pheval_result):
382
+ elif all(isinstance(result, PhEvalDiseaseResult) for result in pheval_result):
383
383
  _write_pheval_disease_result(ranked_pheval_result, output_dir, tool_result_path)
384
384
  else:
385
385
  raise ValueError("Results are not all of the same type.")
@@ -70,35 +70,6 @@ def normalise_file_name(file_path: Path) -> str:
70
70
  return re.sub("[\u0300-\u036f]", "", normalised_file_name)
71
71
 
72
72
 
73
- def obtain_phenopacket_path_from_pheval_result(
74
- pheval_result_path: Path, phenopacket_paths: list[Path]
75
- ) -> Path:
76
- """
77
- Obtains the phenopacket file name when given a pheval result file name
78
- and a list of full paths of phenopackets to be queried.
79
-
80
- Args:
81
- pheval_result_path (Path): The PhEval result.
82
- phenopacket_paths (list[Path]): List of full paths of phenopackets to be queried.
83
-
84
- Returns:
85
- Path: The matching phenopacket file path from the provided list.
86
- """
87
- pheval_result_path_stem_stripped = pheval_result_path.stem.split("-pheval_")[0]
88
- matching_phenopacket_paths = [
89
- phenopacket_path
90
- for phenopacket_path in phenopacket_paths
91
- if phenopacket_path.stem == pheval_result_path_stem_stripped
92
- ]
93
- if matching_phenopacket_paths:
94
- return matching_phenopacket_paths[0]
95
- else:
96
- raise FileNotFoundError(
97
- f"Unable to find matching phenopacket file named "
98
- f"{pheval_result_path_stem_stripped}.json for {pheval_result_path.name}"
99
- )
100
-
101
-
102
73
  def ensure_file_exists(*files: str):
103
74
  """Ensures the existence of files passed as parameter
104
75
  Raises:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pheval
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary:
5
5
  Author: Yasemin Bridges
6
6
  Author-email: y.bridges@qmul.ac.uk
@@ -4,17 +4,17 @@ pheval/analyse/analysis.py,sha256=ponm3P8nvzJNmcrNZ2_KudEhWSaWshd_Gd30D-aau8s,77
4
4
  pheval/analyse/benchmark_generator.py,sha256=AeuwbaPb4j_dyBGPRgEBxQk2NahDb5u4xHyFiqp5Fes,5943
5
5
  pheval/analyse/benchmarking_data.py,sha256=aNZkWdmWemlnC1Tg35MtR60S9YC71QWS2rMuzkUc3w0,768
6
6
  pheval/analyse/binary_classification_stats.py,sha256=E35YjvGM-zFnuEt8M3pgN03vBab4MH6ih726QKvuogg,12519
7
- pheval/analyse/disease_prioritisation_analysis.py,sha256=qadEVhBMtBgtjGCJLhNQA510F8Pd0Ll4NAQXoT23BYs,12649
8
- pheval/analyse/gene_prioritisation_analysis.py,sha256=lAN171xfXqweK8ie6191s_6WPPGjZKJXL1Z0dIqp54k,12373
7
+ pheval/analyse/disease_prioritisation_analysis.py,sha256=mGfGYF5Eu7LxyBkAy6xMG1nDURaPiJY4rRQyKDcQe-4,12451
8
+ pheval/analyse/gene_prioritisation_analysis.py,sha256=KSEQV6EvqtWESmO4Zc3Q9CwrjoMzxRiFUDKuAVvQtuM,12190
9
9
  pheval/analyse/generate_plots.py,sha256=MFORnFTgoelYAahFlu3Dc3Rul4cwCg8Bloxe62vONSc,21350
10
10
  pheval/analyse/generate_summary_outputs.py,sha256=s9pXMSW6xm4ZBe1aCd0UJSaFiKBvpUfPwJ2BI4qfTas,6591
11
11
  pheval/analyse/parse_benchmark_summary.py,sha256=Y8uPTlHTEiaeVBOqxMcdOqjY3ZBtOS3DoRycL78Dzxg,2384
12
- pheval/analyse/parse_pheval_result.py,sha256=j8YFVA0YXfySOkm8gMwrfIuV45DI9AX3ETn7h-r8ayE,1211
12
+ pheval/analyse/parse_pheval_result.py,sha256=2-J_c90KSs49EDjMukl8dgQyWJ0lZMlF-9ZYzD9hWzg,1438
13
13
  pheval/analyse/prioritisation_rank_recorder.py,sha256=EVe8DoEvvp0_WMAcjfVxmDGGRFPEELi7hEVjH3sIpLY,3223
14
14
  pheval/analyse/prioritisation_result_types.py,sha256=qJoB6O-lFYmzAMcTQeDJZQNLJ6hleoKDYATTkhvFF98,1228
15
15
  pheval/analyse/rank_stats.py,sha256=knj1tsKrly17QgtOUVpqA14UjbO99N3ydkWN4xU6c2k,15785
16
16
  pheval/analyse/run_data_parser.py,sha256=HzBKsJL2skjmrRZdrF3VYzswtKNgbX6U5qhY_kqq9mA,1552
17
- pheval/analyse/variant_prioritisation_analysis.py,sha256=ApmUeTW0cl_BPh7LusbApxtgjEXEkhuNFyh0DxKKpgU,12384
17
+ pheval/analyse/variant_prioritisation_analysis.py,sha256=eF3SIvU6MNv1KR8ZmwXvTF4IoNu2qfwaBHA0uKZ8uMc,12186
18
18
  pheval/cli.py,sha256=X4tDi7e3VB3v2RawkqIbfv4SFPCBuQwMXMnYCPTGtIo,1570
19
19
  pheval/cli_pheval.py,sha256=fWbKUcPTZZSa1EJEtH_lNn1XE6qRApRHihqUZS5owrA,2424
20
20
  pheval/cli_pheval_utils.py,sha256=kySsSa7NyewwVwYBMu93y8l5_qSJaVkdXklGchcXExU,20504
@@ -24,7 +24,7 @@ pheval/implementations/__init__.py,sha256=BMUTotjTdgy5j5xubWCIQgRXrSQ1ZIcjooer7r
24
24
  pheval/infra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  pheval/infra/exomiserdb.py,sha256=pM9-TfjrgurtH4OtM1Enk5oVhIxGQN3rKRlrxHuObTM,5080
26
26
  pheval/post_processing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- pheval/post_processing/post_processing.py,sha256=tjdk-LKj5TORwGDKNzEiLViy9oMRLVR9hG1b7E8RfkI,13368
27
+ pheval/post_processing/post_processing.py,sha256=Xzcrb7I0DiLBT3tp0oM8_L8Ld64fTgRHBstQuNSrFHk,13329
28
28
  pheval/prepare/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  pheval/prepare/create_noisy_phenopackets.py,sha256=UbBRWDD95BFHPv03VYx04v35AGwJ9ynLltYKqQJHbZ0,11236
30
30
  pheval/prepare/create_spiked_vcf.py,sha256=A_nIAhoU48nAeocpIu5UE41db4oBGj2cSoT-U-3qQ1Q,21111
@@ -46,12 +46,12 @@ pheval/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  pheval/utils/docs_gen.py,sha256=6FGtHicBC0rZKi0tdL3Epsg8d4osE44I9f1Ga0j4JLA,3193
47
47
  pheval/utils/docs_gen.sh,sha256=LyKLKjaZuf4UJ962CWfM-XqkxtvM8O2N9wHZS5mcb9A,477
48
48
  pheval/utils/exomiser.py,sha256=m2u0PH2z9lFPaB3LVkZCmPmH5e55q1NoTzNl46zRRP8,683
49
- pheval/utils/file_utils.py,sha256=9HoCmtF73D3wY6bBhFLefMBI5uhvCe_meZeHXQzF_ts,4640
49
+ pheval/utils/file_utils.py,sha256=m21cz-qjDYqnI8ClUv3J9fKizex98a-9bSEerQ75i_c,3576
50
50
  pheval/utils/phenopacket_utils.py,sha256=4inrnhZ4UjYgO0Y85ls_Nxq6voAIIXQV57_fMeIX-24,26792
51
51
  pheval/utils/semsim_utils.py,sha256=s7ZCR2VfPYnOh7ApX6rv66eGoVSm9QJaVYOWBEhlXpo,6151
52
52
  pheval/utils/utils.py,sha256=9V6vCT8l1g4O2-ZATYqsVyd7AYZdWGd-Ksy7_oIC3eE,2343
53
- pheval-0.3.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
- pheval-0.3.6.dist-info/METADATA,sha256=VC-lX9dK2KZUkh91WuDK4ygdu6tTw3WSBRkrVe-EZJ0,1810
55
- pheval-0.3.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
56
- pheval-0.3.6.dist-info/entry_points.txt,sha256=o9gSwDkvT4-lqKy4mlsftd1nzP9WUOXQCfnbqycURd0,81
57
- pheval-0.3.6.dist-info/RECORD,,
53
+ pheval-0.3.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
+ pheval-0.3.7.dist-info/METADATA,sha256=BwicFNwmR9Hm8o2YxBJUJvrIeGwAevFFk-DT2pm07S4,1810
55
+ pheval-0.3.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
56
+ pheval-0.3.7.dist-info/entry_points.txt,sha256=o9gSwDkvT4-lqKy4mlsftd1nzP9WUOXQCfnbqycURd0,81
57
+ pheval-0.3.7.dist-info/RECORD,,
File without changes