pheval-exomiser 0.2.1__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.1 → pheval_exomiser-0.2.3}/PKG-INFO +2 -1
  2. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/README.md +1 -0
  3. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/pyproject.toml +1 -1
  4. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/create_batch_commands.py +32 -8
  5. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/tool_specific_configuration_options.py +3 -0
  6. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/run/run.py +6 -0
  7. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/__init__.py +0 -0
  8. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/cli.py +0 -0
  9. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/constants.py +0 -0
  10. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/post_process/__init__.py +0 -0
  11. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/post_process/post_process.py +0 -0
  12. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/post_process/post_process_results_format.py +0 -0
  13. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/__init__.py +0 -0
  14. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/write_application_properties.py +0 -0
  15. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/prepare/yaml_to_family_phenopacket.py +0 -0
  16. {pheval_exomiser-0.2.1 → pheval_exomiser-0.2.3}/src/pheval_exomiser/run/__init__.py +0 -0
  17. {pheval_exomiser-0.2.1 → 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.1
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.1"
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,13 +1,12 @@
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
9
8
  from pheval.prepare.custom_exceptions import MutuallyExclusiveOptionError
10
- from pheval.utils.file_utils import all_files, files_with_suffix, obtain_closest_file_name
9
+ from pheval.utils.file_utils import all_files, files_with_suffix
11
10
  from pheval.utils.phenopacket_utils import PhenopacketUtil, phenopacket_reader
12
11
 
13
12
  from pheval_exomiser.constants import (
@@ -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,
@@ -69,7 +71,9 @@ class CommandCreator:
69
71
  return (
70
72
  self.output_options_file
71
73
  if self.output_options_dir_files is None
72
- else obtain_closest_file_name(self.phenopacket_path, self.output_options_dir_files)
74
+ else self.output_options_dir_files[0].parent.joinpath(
75
+ self.phenopacket_path.stem + "-output_options.yml"
76
+ )
73
77
  )
74
78
 
75
79
  def add_phenotype_only_arguments(self) -> ExomiserCommandLineArguments:
@@ -84,6 +88,7 @@ class CommandCreator:
84
88
  else None
85
89
  ),
86
90
  raw_results_dir=RAW_RESULTS_TARGET_DIRECTORY_DOCKER,
91
+ output_formats=self.output_formats,
87
92
  )
88
93
  elif self.environment == "local":
89
94
  return ExomiserCommandLineArguments(
@@ -91,6 +96,7 @@ class CommandCreator:
91
96
  variant_analysis=self.variant_analysis,
92
97
  output_options_file=output_options_file,
93
98
  raw_results_dir=self.results_dir,
99
+ output_formats=self.output_formats,
94
100
  )
95
101
 
96
102
  def add_variant_analysis_arguments(self, vcf_dir: Path) -> ExomiserCommandLineArguments:
@@ -107,6 +113,7 @@ class CommandCreator:
107
113
  variant_analysis=self.variant_analysis,
108
114
  raw_results_dir=self.results_dir,
109
115
  analysis_yaml=self.analysis_yaml,
116
+ output_formats=self.output_formats,
110
117
  )
111
118
  elif self.environment == "docker":
112
119
  return ExomiserCommandLineArguments(
@@ -141,7 +148,8 @@ def create_command_arguments(
141
148
  output_options_dir: Path or None = None,
142
149
  output_options_file: Path or None = None,
143
150
  analysis_yaml: Path or None = None,
144
- ) -> list[ExomiserCommandLineArguments]:
151
+ output_formats: List[str] or None = None,
152
+ ) -> List[ExomiserCommandLineArguments]:
145
153
  """Return a list of Exomiser command line arguments for a directory of phenopackets."""
146
154
  phenopacket_paths = files_with_suffix(phenopacket_dir, ".json")
147
155
  commands = []
@@ -158,6 +166,7 @@ def create_command_arguments(
158
166
  output_options_file,
159
167
  results_dir,
160
168
  analysis_yaml,
169
+ output_formats,
161
170
  ).add_command_line_arguments(vcf_dir)
162
171
  )
163
172
  return commands
@@ -210,10 +219,22 @@ class CommandsWriter:
210
219
  except IOError:
211
220
  print("Error writing ", self.file)
212
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
+
213
233
  def write_analysis_command(self, command_arguments: ExomiserCommandLineArguments):
214
234
  self.write_basic_analysis_command(command_arguments)
215
235
  self.write_results_dir(command_arguments)
216
236
  self.write_output_options(command_arguments)
237
+ self.write_output_format(command_arguments)
217
238
  self.file.write("\n")
218
239
 
219
240
  def write_basic_phenotype_only_command(
@@ -237,6 +258,7 @@ class CommandsWriter:
237
258
  def write_phenotype_only_command(self, command_arguments: ExomiserCommandLineArguments):
238
259
  self.write_basic_phenotype_only_command(command_arguments)
239
260
  self.write_output_options(command_arguments)
261
+ self.write_output_format(command_arguments)
240
262
  self.file.write("\n")
241
263
 
242
264
  def write_local_commands(self, command_arguments: ExomiserCommandLineArguments):
@@ -259,7 +281,7 @@ class BatchFileWriter:
259
281
 
260
282
  def __init__(
261
283
  self,
262
- command_arguments_list: list[ExomiserCommandLineArguments],
284
+ command_arguments_list: List[ExomiserCommandLineArguments],
263
285
  variant_analysis: bool,
264
286
  output_dir: Path,
265
287
  batch_prefix: str,
@@ -324,6 +346,7 @@ def create_batch_file(
324
346
  results_dir: Path,
325
347
  output_options_dir: Path = None,
326
348
  output_options_file: Path = None,
349
+ output_formats: List[str] = None,
327
350
  ) -> None:
328
351
  """Create Exomiser batch files."""
329
352
  command_arguments = create_command_arguments(
@@ -335,6 +358,7 @@ def create_batch_file(
335
358
  output_options_dir,
336
359
  output_options_file,
337
360
  analysis,
361
+ output_formats,
338
362
  )
339
363
  (
340
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