pheval-exomiser 0.2.2__tar.gz → 0.2.3__tar.gz

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.
Files changed (17) hide show
  1. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/PKG-INFO +2 -1
  2. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/README.md +1 -0
  3. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/pyproject.toml +1 -1
  4. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/create_batch_commands.py +28 -6
  5. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/tool_specific_configuration_options.py +3 -0
  6. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/run/run.py +6 -0
  7. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/__init__.py +0 -0
  8. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/cli.py +0 -0
  9. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/constants.py +0 -0
  10. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/post_process/__init__.py +0 -0
  11. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/post_process/post_process.py +0 -0
  12. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/post_process/post_process_results_format.py +0 -0
  13. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/__init__.py +0 -0
  14. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/write_application_properties.py +0 -0
  15. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/yaml_to_family_phenopacket.py +0 -0
  16. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/run/__init__.py +0 -0
  17. {pheval_exomiser-0.2.2 → pheval_exomiser-0.2.3}/src/pheval_exomiser/runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pheval_exomiser
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary:
5
5
  Author: Yasemin Bridges
6
6
  Author-email: y.bridges@qmul.ac.uk
@@ -65,6 +65,7 @@ tool_specific_configuration_options:
65
65
  phenotype_data_version: 2302
66
66
  cache_type:
67
67
  cache_caffeine_spec:
68
+ output_formats: [JSON,HTML] # options include HTML, JSON, TSV_VARIANT, TSV_GENE, VCF
68
69
  post_process:
69
70
  score_name: combinedScore
70
71
  sort_order: DESCENDING
@@ -42,6 +42,7 @@ tool_specific_configuration_options:
42
42
  phenotype_data_version: 2302
43
43
  cache_type:
44
44
  cache_caffeine_spec:
45
+ output_formats: [JSON,HTML] # options include HTML, JSON, TSV_VARIANT, TSV_GENE, VCF
45
46
  post_process:
46
47
  score_name: combinedScore
47
48
  sort_order: DESCENDING
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pheval_exomiser"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = ""
5
5
  authors = ["Yasemin Bridges <y.bridges@qmul.ac.uk>",
6
6
  "Julius Jacobsen <j.jacobsen@qmul.ac.uk>",
@@ -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