pheval-exomiser 0.2.2__py3-none-any.whl → 0.2.4__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.
@@ -1,8 +1,7 @@
1
- #!/usr/bin/python
2
1
  import tempfile
3
2
  from dataclasses import dataclass
4
3
  from pathlib import Path
5
- from typing import Optional
4
+ from typing import List, Optional
6
5
 
7
6
  import click
8
7
  from phenopackets import Family, Phenopacket
@@ -30,9 +29,10 @@ class ExomiserCommandLineArguments:
30
29
  raw_results_dir: Path or None = None
31
30
  variant_analysis: bool or None = None
32
31
  output_options_file: Optional[Path] = None
32
+ output_formats: List[str] or None = None
33
33
 
34
34
 
35
- def get_all_files_from_output_opt_directory(output_options_dir: Path) -> list[Path] or None:
35
+ def get_all_files_from_output_opt_directory(output_options_dir: Path) -> List[Path] or None:
36
36
  """Obtain all output options files if directory is specified - otherwise returns none."""
37
37
  return None if output_options_dir is None else all_files(output_options_dir)
38
38
 
@@ -46,10 +46,11 @@ class CommandCreator:
46
46
  phenopacket_path: Path,
47
47
  phenopacket: Phenopacket or Family,
48
48
  variant_analysis: bool,
49
- output_options_dir_files: list[Path] or None,
49
+ output_options_dir_files: List[Path] or None,
50
50
  output_options_file: Path or None,
51
51
  raw_results_dir: Path or None,
52
52
  analysis_yaml: Path or None,
53
+ output_formats: List[str] or None,
53
54
  ):
54
55
  self.environment = environment
55
56
  self.phenopacket_path = phenopacket_path
@@ -59,6 +60,7 @@ class CommandCreator:
59
60
  self.output_options_file = output_options_file
60
61
  self.results_dir = raw_results_dir
61
62
  self.analysis_yaml = analysis_yaml
63
+ self.output_formats = output_formats
62
64
 
63
65
  def assign_output_options_file(self) -> Path or None:
64
66
  """Return the path of a single output option yaml if specified,
@@ -86,6 +88,7 @@ class CommandCreator:
86
88
  else None
87
89
  ),
88
90
  raw_results_dir=RAW_RESULTS_TARGET_DIRECTORY_DOCKER,
91
+ output_formats=self.output_formats,
89
92
  )
90
93
  elif self.environment == "local":
91
94
  return ExomiserCommandLineArguments(
@@ -93,6 +96,7 @@ class CommandCreator:
93
96
  variant_analysis=self.variant_analysis,
94
97
  output_options_file=output_options_file,
95
98
  raw_results_dir=self.results_dir,
99
+ output_formats=self.output_formats,
96
100
  )
97
101
 
98
102
  def add_variant_analysis_arguments(self, vcf_dir: Path) -> ExomiserCommandLineArguments:
@@ -109,6 +113,7 @@ class CommandCreator:
109
113
  variant_analysis=self.variant_analysis,
110
114
  raw_results_dir=self.results_dir,
111
115
  analysis_yaml=self.analysis_yaml,
116
+ output_formats=self.output_formats,
112
117
  )
113
118
  elif self.environment == "docker":
114
119
  return ExomiserCommandLineArguments(
@@ -143,7 +148,8 @@ def create_command_arguments(
143
148
  output_options_dir: Path or None = None,
144
149
  output_options_file: Path or None = None,
145
150
  analysis_yaml: Path or None = None,
146
- ) -> list[ExomiserCommandLineArguments]:
151
+ output_formats: List[str] or None = None,
152
+ ) -> List[ExomiserCommandLineArguments]:
147
153
  """Return a list of Exomiser command line arguments for a directory of phenopackets."""
148
154
  phenopacket_paths = files_with_suffix(phenopacket_dir, ".json")
149
155
  commands = []
@@ -160,6 +166,7 @@ def create_command_arguments(
160
166
  output_options_file,
161
167
  results_dir,
162
168
  analysis_yaml,
169
+ output_formats,
163
170
  ).add_command_line_arguments(vcf_dir)
164
171
  )
165
172
  return commands
@@ -212,10 +219,22 @@ class CommandsWriter:
212
219
  except IOError:
213
220
  print("Error writing ", self.file)
214
221
 
222
+ def write_output_format(self, command_arguments: ExomiserCommandLineArguments) -> None:
223
+ """Write output formats for Exomiser raw result output."""
224
+ try:
225
+ (
226
+ self.file.write(" --output-format " + ",".join(command_arguments.output_formats))
227
+ if command_arguments.output_formats is not None
228
+ else None
229
+ )
230
+ except IOError:
231
+ print("Error writing ", self.file)
232
+
215
233
  def write_analysis_command(self, command_arguments: ExomiserCommandLineArguments):
216
234
  self.write_basic_analysis_command(command_arguments)
217
235
  self.write_results_dir(command_arguments)
218
236
  self.write_output_options(command_arguments)
237
+ self.write_output_format(command_arguments)
219
238
  self.file.write("\n")
220
239
 
221
240
  def write_basic_phenotype_only_command(
@@ -239,6 +258,7 @@ class CommandsWriter:
239
258
  def write_phenotype_only_command(self, command_arguments: ExomiserCommandLineArguments):
240
259
  self.write_basic_phenotype_only_command(command_arguments)
241
260
  self.write_output_options(command_arguments)
261
+ self.write_output_format(command_arguments)
242
262
  self.file.write("\n")
243
263
 
244
264
  def write_local_commands(self, command_arguments: ExomiserCommandLineArguments):
@@ -261,7 +281,7 @@ class BatchFileWriter:
261
281
 
262
282
  def __init__(
263
283
  self,
264
- command_arguments_list: list[ExomiserCommandLineArguments],
284
+ command_arguments_list: List[ExomiserCommandLineArguments],
265
285
  variant_analysis: bool,
266
286
  output_dir: Path,
267
287
  batch_prefix: str,
@@ -326,6 +346,7 @@ def create_batch_file(
326
346
  results_dir: Path,
327
347
  output_options_dir: Path = None,
328
348
  output_options_file: Path = None,
349
+ output_formats: List[str] = None,
329
350
  ) -> None:
330
351
  """Create Exomiser batch files."""
331
352
  command_arguments = create_command_arguments(
@@ -337,6 +358,7 @@ def create_batch_file(
337
358
  output_options_dir,
338
359
  output_options_file,
339
360
  analysis,
361
+ output_formats,
340
362
  )
341
363
  (
342
364
  BatchFileWriter(
@@ -1,4 +1,5 @@
1
1
  from pathlib import Path
2
+ from typing import List
2
3
 
3
4
  from pydantic import BaseModel, Field
4
5
 
@@ -54,6 +55,7 @@ class ExomiserConfigurations(BaseModel):
54
55
  analysis_configuration_file (Path): The file name of the analysis configuration file located in the input_dir
55
56
  max_jobs (int): Maximum number of jobs to run in a batch
56
57
  application_properties (ApplicationProperties): application.properties configurations
58
+ output_formats: List(str): List of raw output formats.
57
59
  post_process (PostProcessing): Post-processing configurations
58
60
  """
59
61
 
@@ -62,4 +64,5 @@ class ExomiserConfigurations(BaseModel):
62
64
  analysis_configuration_file: Path = Field(...)
63
65
  max_jobs: int = Field(...)
64
66
  application_properties: ApplicationProperties = Field(...)
67
+ output_formats: List[str] = Field(None)
65
68
  post_process: PostProcessing = Field(...)
@@ -31,6 +31,11 @@ def prepare_batch_files(
31
31
  """Prepare the exomiser batch files"""
32
32
  print("...preparing batch files...")
33
33
  vcf_dir_name = Path(testdata_dir).joinpath("vcf")
34
+ output_formats = (
35
+ config.output_formats + ["JSON"]
36
+ if config.output_formats and "JSON" not in config.output_formats
37
+ else config.output_formats
38
+ )
34
39
  create_batch_file(
35
40
  environment=config.environment,
36
41
  analysis=input_dir.joinpath(config.analysis_configuration_file),
@@ -43,6 +48,7 @@ def prepare_batch_files(
43
48
  output_options_dir=None,
44
49
  results_dir=raw_results_dir,
45
50
  variant_analysis=variant_analysis,
51
+ output_formats=output_formats,
46
52
  )
47
53
 
48
54
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pheval_exomiser
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary:
5
5
  Author: Yasemin Bridges
6
6
  Author-email: y.bridges@qmul.ac.uk
@@ -16,7 +16,7 @@ Requires-Dist: google (>=3.0.0,<4.0.0)
16
16
  Requires-Dist: oaklib (>=0.5.12,<0.6.0)
17
17
  Requires-Dist: pandas (>=1.5.2,<2.0.0)
18
18
  Requires-Dist: phenopackets (>=2.0.2,<3.0.0)
19
- Requires-Dist: pheval (>=0.3.1,<0.4.0)
19
+ Requires-Dist: pheval (>=0.4.0,<0.5.0)
20
20
  Requires-Dist: pyaml (>=21.10.1,<22.0.0)
21
21
  Requires-Dist: pydantic (>=1.10.7,<2.0.0)
22
22
  Description-Content-Type: text/markdown
@@ -27,7 +27,13 @@ This is the Exomiser plugin for PhEval. With this plugin, you can leverage the v
27
27
 
28
28
  ## Installation
29
29
 
30
- Clone the pheval.exomiser repo and set up the poetry environment:
30
+ You can install the Exomiser directly with PyPi (recommended):
31
+
32
+ ```shell
33
+ pip install pheval.exomiser
34
+ ```
35
+
36
+ Alternatively you can clone the pheval.exomiser repo and set up the poetry environment:
31
37
 
32
38
  ```shell
33
39
  git clone https://github.com/monarch-initiative/pheval.exomiser.git
@@ -65,6 +71,7 @@ tool_specific_configuration_options:
65
71
  phenotype_data_version: 2302
66
72
  cache_type:
67
73
  cache_caffeine_spec:
74
+ output_formats: [JSON,HTML] # options include HTML, JSON, TSV_VARIANT, TSV_GENE, VCF
68
75
  post_process:
69
76
  score_name: combinedScore
70
77
  sort_order: DESCENDING
@@ -79,6 +86,8 @@ The analysis configuration file (in this case: `preset-exome-analysis.yml`) shou
79
86
 
80
87
  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
88
 
89
+ To save on diskspace we recommend limiting the Exomiser output to JSON, this can be specified by setting the `output_formats` field in the `config.yaml` to [JSON]
90
+
82
91
  If using optional databases, such as REMM/CADD/local frequency the optional data input should look like so in the input
83
92
  directory:
84
93
 
@@ -141,7 +150,7 @@ The overall structure of the input directory should look like this with the cadd
141
150
  ```
142
151
  ### Setting up the testdata directory
143
152
 
144
- The Exomiser plugin for PhEval accepts phenopackets and vcf files as an input for running Exomiser. The plugin can be run in `phenotype_only` mode, where only phenopackets are required as an input, however, this *must* be specified in the `config.yaml`.
153
+ The Exomiser plugin for PhEval accepts phenopackets and vcf files as an input for running Exomiser. The plugin can be run in `phenotype_only` mode, where only phenopackets are required as an input, however, this *must* be specified in the `config.yaml` by setting `variant_analysis: False`
145
154
 
146
155
  The testdata directory should include subdirectories named `phenopackets` and `vcf` if running with variant prioritisation.
147
156
 
@@ -181,3 +190,4 @@ To fix the error, `setuptools` needs to be downgraded to version 66:
181
190
  pip uninstall setuptools
182
191
  pip install -U setuptools=="66"
183
192
  ```
193
+
@@ -5,14 +5,14 @@ pheval_exomiser/post_process/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
5
5
  pheval_exomiser/post_process/post_process.py,sha256=ZLIGPeADGZn08jFc152QraiJnYSADlL35GOwxkCQDwA,901
6
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=G2VJ6xPgajYcNovVO1iC2PKePbU97-BqjbBONiC-hy4,16224
9
- pheval_exomiser/prepare/tool_specific_configuration_options.py,sha256=i4aXdEVfAnA6uQD4ZOk_OO4nXAVIFQ1nN_aVul56DZg,2661
8
+ pheval_exomiser/prepare/create_batch_commands.py,sha256=tDUBtpfSmNGqHte-vrGnusYZzM59pOX1IAumqRDlnBE,17205
9
+ pheval_exomiser/prepare/tool_specific_configuration_options.py,sha256=Fd7Jfr6QwHhL1JK69D8FMwaAXe3cnG4IrBrB9JyEKlg,2792
10
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
- pheval_exomiser/run/run.py,sha256=6RokrunCoouhP_c4xpGR3EDzK6nxx_iOgyG3q1PYZmk,6892
13
+ pheval_exomiser/run/run.py,sha256=bK_gL52zRl71Lxe-i-P6L4-dMstxFAG6SVNPO6G823o,7109
14
14
  pheval_exomiser/runner.py,sha256=LaWhC0F9LoPvP0Ie1sG2GkC8EG-tWjBBY_tFYmx6dxA,2548
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,,
15
+ pheval_exomiser-0.2.4.dist-info/METADATA,sha256=BAfOlCbgucdlTto6PvpqYUZKqxb6alQfFKm0DxGEwUA,7475
16
+ pheval_exomiser-0.2.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
17
+ pheval_exomiser-0.2.4.dist-info/entry_points.txt,sha256=lbZMu-x7ns8UrFveWSqEQ1UB5l33TbRMomqBUyGYIwI,131
18
+ pheval_exomiser-0.2.4.dist-info/RECORD,,