pheval-exomiser 0.2.0__py3-none-any.whl → 0.2.2__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.
@@ -61,6 +61,7 @@ class PhEvalGeneResultFromExomiserJsonCreator:
61
61
 
62
62
 
63
63
  class PhEvalVariantResultFromExomiserJsonCreator:
64
+
64
65
  def __init__(self, exomiser_json_result: [dict], score_name: str):
65
66
  self.exomiser_json_result = exomiser_json_result
66
67
  self.score_name = score_name
@@ -97,7 +98,27 @@ class PhEvalVariantResultFromExomiserJsonCreator:
97
98
  """Return score from Exomiser result entry."""
98
99
  return round(result_entry[self.score_name], 4)
99
100
 
100
- def extract_pheval_variant_requirements(self) -> [PhEvalVariantResult]:
101
+ def _filter_for_acmg_assignments(
102
+ self, variant: PhEvalVariantResult, score: float, variant_acmg_assignments: dict
103
+ ) -> bool:
104
+ """Filter variants if they meet the PATHOGENIC or LIKELY_PATHOGENIC ACMG classification."""
105
+ for assignment in variant_acmg_assignments:
106
+ if variant == PhEvalVariantResult(
107
+ chromosome=self._find_chromosome(assignment["variantEvaluation"]),
108
+ start=self._find_start_pos(assignment["variantEvaluation"]),
109
+ end=self._find_end_pos(assignment["variantEvaluation"]),
110
+ ref=self._find_ref(assignment["variantEvaluation"]),
111
+ alt=self._find_alt(assignment["variantEvaluation"]),
112
+ score=score,
113
+ ) and (
114
+ assignment["acmgClassification"] == "PATHOGENIC"
115
+ or assignment["acmgClassification"] == "LIKELY_PATHOGENIC"
116
+ ):
117
+ return True
118
+
119
+ def extract_pheval_variant_requirements(
120
+ self, use_acmg_filter: bool = False
121
+ ) -> [PhEvalVariantResult]:
101
122
  """Extract data required to produce PhEval variant output."""
102
123
  simplified_exomiser_result = []
103
124
  for result_entry in self.exomiser_json_result:
@@ -105,17 +126,23 @@ class PhEvalVariantResultFromExomiserJsonCreator:
105
126
  if self.score_name in result_entry:
106
127
  if "contributingVariants" in gene_hit:
107
128
  score = self._find_relevant_score(result_entry)
108
- for cv in gene_hit["contributingVariants"]:
109
- simplified_exomiser_result.append(
110
- PhEvalVariantResult(
111
- chromosome=self._find_chromosome(cv),
112
- start=self._find_start_pos(cv),
113
- end=self._find_end_pos(cv),
114
- ref=self._find_ref(cv),
115
- alt=self._find_alt(cv),
116
- score=score,
117
- )
129
+ contributing_variants = gene_hit["contributingVariants"]
130
+ variant_acmg_assignments = gene_hit["acmgAssignments"]
131
+ for cv in contributing_variants:
132
+ variant = PhEvalVariantResult(
133
+ chromosome=self._find_chromosome(cv),
134
+ start=self._find_start_pos(cv),
135
+ end=self._find_end_pos(cv),
136
+ ref=self._find_ref(cv),
137
+ alt=self._find_alt(cv),
138
+ score=score,
118
139
  )
140
+ if use_acmg_filter and self._filter_for_acmg_assignments(
141
+ variant, score, variant_acmg_assignments
142
+ ):
143
+ simplified_exomiser_result.append(variant)
144
+ if not use_acmg_filter:
145
+ simplified_exomiser_result.append(variant)
119
146
  return simplified_exomiser_result
120
147
 
121
148
 
@@ -166,6 +193,7 @@ def create_standardised_results(
166
193
  variant_analysis: bool,
167
194
  gene_analysis: bool,
168
195
  disease_analysis: bool,
196
+ include_acmg: bool = False,
169
197
  ) -> None:
170
198
  """Write standardised gene/variant/disease results from default Exomiser json output."""
171
199
  for exomiser_json_result in files_with_suffix(results_dir, ".json"):
@@ -183,7 +211,7 @@ def create_standardised_results(
183
211
  if variant_analysis:
184
212
  pheval_variant_requirements = PhEvalVariantResultFromExomiserJsonCreator(
185
213
  exomiser_result, score_name
186
- ).extract_pheval_variant_requirements()
214
+ ).extract_pheval_variant_requirements(include_acmg)
187
215
  generate_pheval_result(
188
216
  pheval_result=pheval_variant_requirements,
189
217
  sort_order_str=sort_order,
@@ -255,6 +283,13 @@ def create_standardised_results(
255
283
  default=False,
256
284
  help="Specify whether to create PhEval disease results.",
257
285
  )
286
+ @click.option(
287
+ "--include-acmg",
288
+ is_flag=True,
289
+ type=bool,
290
+ default=False,
291
+ help="Specify whether to include ACMG filter for PATHOGENIC or LIKELY_PATHOGENIC classifications.",
292
+ )
258
293
  def post_process_exomiser_results(
259
294
  output_dir: Path,
260
295
  results_dir: Path,
@@ -263,6 +298,7 @@ def post_process_exomiser_results(
263
298
  gene_analysis: bool,
264
299
  variant_analysis: bool,
265
300
  disease_analysis: bool,
301
+ include_acmg: bool,
266
302
  ):
267
303
  """Post-process Exomiser json results into PhEval gene and variant outputs."""
268
304
  (
@@ -288,4 +324,5 @@ def post_process_exomiser_results(
288
324
  variant_analysis,
289
325
  gene_analysis,
290
326
  disease_analysis,
327
+ include_acmg,
291
328
  )
@@ -7,7 +7,7 @@ from typing import Optional
7
7
  import click
8
8
  from phenopackets import Family, Phenopacket
9
9
  from pheval.prepare.custom_exceptions import MutuallyExclusiveOptionError
10
- from pheval.utils.file_utils import all_files, files_with_suffix, obtain_closest_file_name
10
+ from pheval.utils.file_utils import all_files, files_with_suffix
11
11
  from pheval.utils.phenopacket_utils import PhenopacketUtil, phenopacket_reader
12
12
 
13
13
  from pheval_exomiser.constants import (
@@ -69,7 +69,9 @@ class CommandCreator:
69
69
  return (
70
70
  self.output_options_file
71
71
  if self.output_options_dir_files is None
72
- else obtain_closest_file_name(self.phenopacket_path, self.output_options_dir_files)
72
+ else self.output_options_dir_files[0].parent.joinpath(
73
+ self.phenopacket_path.stem + "-output_options.yml"
74
+ )
73
75
  )
74
76
 
75
77
  def add_phenotype_only_arguments(self) -> ExomiserCommandLineArguments:
@@ -182,6 +184,8 @@ class CommandsWriter:
182
184
  + str(command_arguments.vcf_file)
183
185
  + " --assembly "
184
186
  + command_arguments.vcf_assembly
187
+ + " --output-filename "
188
+ + f"{command_arguments.sample.stem}-exomiser"
185
189
  )
186
190
  except IOError:
187
191
  print("Error writing ", self.file)
@@ -11,8 +11,10 @@ class ApplicationProperties(BaseModel):
11
11
  cadd_version (str): Version of the CADD database
12
12
  hg19_data_version (str): Data version of the hg19 Exomiser data
13
13
  hg19_local_frequency_path (Path): The file name of the hg19 local frequency file
14
+ hg19_whitelist_path (Path): The file name of the hg19 whitelist.
14
15
  hg38_data_version (str): Data version of the hg38 Exomiser data
15
16
  hg38_local_frequency_path (Path): The file name of the hg38 local frequency file
17
+ hg38_whitelist_path (Path): The file name of the hg38 whitelist.
16
18
  phenotype_data_version (str): Data version of the Exomiser phenotype data
17
19
  cache_caffeine_spec (int): Cache limit
18
20
  """
@@ -21,8 +23,10 @@ class ApplicationProperties(BaseModel):
21
23
  cadd_version: str = Field(None)
22
24
  hg19_data_version: str = Field(None)
23
25
  hg19_local_frequency_path: Path = Field(None)
26
+ hg19_whitelist_path: Path = Field(None)
24
27
  hg38_data_version: str = Field(None)
25
28
  hg38_local_frequency_path: Path = Field(None)
29
+ hg38_whitelist_path: Path = Field(None)
26
30
  phenotype_data_version: str = Field(None)
27
31
  cache_type: str = Field(None)
28
32
  cache_caffeine_spec: int = Field(None)
@@ -144,16 +144,18 @@ class ExomiserConfigurationFileWriter:
144
144
 
145
145
  def write_hg19_white_list_path(self) -> None:
146
146
  """Write the hg19 whitelist path to application.properties file."""
147
- if self.configurations.application_properties.hg19_data_version is not None:
147
+ if self.configurations.application_properties.hg19_whitelist_path is not None:
148
148
  self.application_properties.write(
149
- "exomiser.hg19.variant-white-list-path=${exomiser.hg19.data-version}_hg19_clinvar_whitelist.tsv.gz\n"
149
+ f"exomiser.hg19.variant-white-list-path="
150
+ f"{self.configurations.application_properties.hg19_whitelist_path}\n"
150
151
  )
151
152
 
152
153
  def write_hg38_white_list_path(self) -> None:
153
154
  """Write the hg38 whitelist path to application.properties file."""
154
- if self.configurations.application_properties.hg38_data_version is not None:
155
+ if self.configurations.application_properties.hg38_whitelist_path is not None:
155
156
  self.application_properties.write(
156
- "exomiser.hg38.variant-white-list-path=${exomiser.hg38.data-version}_hg38_clinvar_whitelist.tsv.gz\n"
157
+ f"exomiser.hg38.variant-white-list-path="
158
+ f"{self.configurations.application_properties.hg38_whitelist_path}\n"
157
159
  )
158
160
 
159
161
  def write_cache_type(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pheval_exomiser
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary:
5
5
  Author: Yasemin Bridges
6
6
  Author-email: y.bridges@qmul.ac.uk
@@ -58,8 +58,10 @@ tool_specific_configuration_options:
58
58
  cadd_version:
59
59
  hg19_data_version: 2302
60
60
  hg19_local_frequency_path: # name of hg19 local frequency file
61
+ hg19_whitelist_path: 2302_hg19_clinvar_whitelist.tsv.gz # only required for Exomiser v13.3.0 and earlier, can be left blank for Exomiser v14.0.0 onwards.
61
62
  hg38_data_version: 2302
62
63
  hg38_local_frequency_path: # name of hg38 local frequency file
64
+ hg38_whitelist_path:
63
65
  phenotype_data_version: 2302
64
66
  cache_type:
65
67
  cache_caffeine_spec:
@@ -75,6 +77,8 @@ The `exomiser_software_directory` points to the name of the Exomiser distributio
75
77
 
76
78
  The analysis configuration file (in this case: `preset-exome-analysis.yml`) should be located within the input directory.
77
79
 
80
+ The whitelist paths for the hg19 and hg38 dbs need only be specified for Exomiser v13.3.0 and earlier (unless specifying your own whitelist), as Exomiser v14.0.0 now includes this in the db.
81
+
78
82
  If using optional databases, such as REMM/CADD/local frequency the optional data input should look like so in the input
79
83
  directory:
80
84
 
@@ -3,16 +3,16 @@ pheval_exomiser/cli.py,sha256=0SR1-L2sREEkFRfUPwYwkbSaBsz_L_Sxq1S4c9LQLJg,350
3
3
  pheval_exomiser/constants.py,sha256=o_pLWF8kX74BqyTsAZa7twwSKzedLnpupCI90k_bMqY,517
4
4
  pheval_exomiser/post_process/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  pheval_exomiser/post_process/post_process.py,sha256=ZLIGPeADGZn08jFc152QraiJnYSADlL35GOwxkCQDwA,901
6
- pheval_exomiser/post_process/post_process_results_format.py,sha256=AYjU1V4b4_GTVuLvuqvqsygX7ewU3cxHKmrLW9-z1o0,10410
6
+ pheval_exomiser/post_process/post_process_results_format.py,sha256=WVtCQv5uiFk-6xL6zKsB0VWR2L52kCji_1fsXLitX3o,12112
7
7
  pheval_exomiser/prepare/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- pheval_exomiser/prepare/create_batch_commands.py,sha256=e_yIC9mALgZ_kop9wwR9XNkx5a3NOSrTjkmUG0k6Qvc,16088
9
- pheval_exomiser/prepare/tool_specific_configuration_options.py,sha256=YHAobmTCtsk6vbipT3IPyB3vG6dG4PldPfyAly2StMg,2427
10
- pheval_exomiser/prepare/write_application_properties.py,sha256=uFBNj6AEt3K-gNMNvFYRltVwVHtI-BzSsjLHy52ZeoQ,8877
8
+ pheval_exomiser/prepare/create_batch_commands.py,sha256=G2VJ6xPgajYcNovVO1iC2PKePbU97-BqjbBONiC-hy4,16224
9
+ pheval_exomiser/prepare/tool_specific_configuration_options.py,sha256=i4aXdEVfAnA6uQD4ZOk_OO4nXAVIFQ1nN_aVul56DZg,2661
10
+ pheval_exomiser/prepare/write_application_properties.py,sha256=KmG7GvkQo8AhnhRyqohTFvqjfhEhbcs78UYYoigxJ3w,8933
11
11
  pheval_exomiser/prepare/yaml_to_family_phenopacket.py,sha256=Hz77dHpVaRMV1fQWKmOCqCKJfmk_hdpZh_6o7hq9Sec,14452
12
12
  pheval_exomiser/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  pheval_exomiser/run/run.py,sha256=6RokrunCoouhP_c4xpGR3EDzK6nxx_iOgyG3q1PYZmk,6892
14
14
  pheval_exomiser/runner.py,sha256=LaWhC0F9LoPvP0Ie1sG2GkC8EG-tWjBBY_tFYmx6dxA,2548
15
- pheval_exomiser-0.2.0.dist-info/METADATA,sha256=F8y5fYes22EQpgGq32NqC2PEMk9zgAOOzqEgQj7KlBQ,6684
16
- pheval_exomiser-0.2.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
17
- pheval_exomiser-0.2.0.dist-info/entry_points.txt,sha256=lbZMu-x7ns8UrFveWSqEQ1UB5l33TbRMomqBUyGYIwI,131
18
- pheval_exomiser-0.2.0.dist-info/RECORD,,
15
+ pheval_exomiser-0.2.2.dist-info/METADATA,sha256=rdejFLD-k0Ngc8lEtSCrU-QSoLkKiI7pGroWcat8rfA,7059
16
+ pheval_exomiser-0.2.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
17
+ pheval_exomiser-0.2.2.dist-info/entry_points.txt,sha256=lbZMu-x7ns8UrFveWSqEQ1UB5l33TbRMomqBUyGYIwI,131
18
+ pheval_exomiser-0.2.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any