pheval-exomiser 0.3.3__tar.gz → 0.3.4__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 (16) hide show
  1. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/PKG-INFO +3 -2
  2. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/pyproject.toml +1 -1
  3. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/prepare/create_batch_commands.py +117 -101
  4. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/README.md +0 -0
  5. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/__init__.py +0 -0
  6. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/cli.py +0 -0
  7. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/constants.py +0 -0
  8. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/post_process/__init__.py +0 -0
  9. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/post_process/post_process.py +0 -0
  10. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/post_process/post_process_results_format.py +0 -0
  11. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/prepare/__init__.py +0 -0
  12. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/prepare/tool_specific_configuration_options.py +0 -0
  13. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/prepare/write_application_properties.py +0 -0
  14. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/run/__init__.py +0 -0
  15. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/run/run.py +0 -0
  16. {pheval_exomiser-0.3.3 → pheval_exomiser-0.3.4}/src/pheval_exomiser/runner.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: pheval_exomiser
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary:
5
5
  Author: Yasemin Bridges
6
6
  Author-email: y.bridges@qmul.ac.uk
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
13
14
  Requires-Dist: click (>=8.1.3,<9.0.0)
14
15
  Requires-Dist: docker (>=6.0.1,<7.0.0)
15
16
  Requires-Dist: google (>=3.0.0,<4.0.0)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pheval_exomiser"
3
- version = "0.3.3"
3
+ version = "0.3.4"
4
4
  description = ""
5
5
  authors = ["Yasemin Bridges <y.bridges@qmul.ac.uk>",
6
6
  "Julius Jacobsen <j.jacobsen@qmul.ac.uk>",
@@ -23,13 +23,13 @@ class ExomiserCommandLineArguments:
23
23
  """Store command line arguments for each phenopacket to be run with Exomiser."""
24
24
 
25
25
  sample: Path
26
- analysis_yaml: Path or None = None
27
- vcf_file: Path or None = None
28
- vcf_assembly: str or None = None
29
- raw_results_dir: Path or None = None
30
- variant_analysis: bool or None = None
26
+ analysis_yaml: Optional[Path] = None
27
+ vcf_file: Optional[Path] = None
28
+ vcf_assembly: Optional[str] = None
29
+ raw_results_dir: Optional[Path] = None
30
+ variant_analysis: Optional[bool] = None
31
31
  output_options_file: Optional[Path] = None
32
- output_formats: List[str] or None = None
32
+ output_formats: Optional[List[str]] = None
33
33
 
34
34
 
35
35
  def get_all_files_from_output_opt_directory(output_options_dir: Path) -> List[Path] or None:
@@ -80,39 +80,41 @@ class CommandCreator:
80
80
  output_options_file = self.assign_output_options_file()
81
81
  if self.environment == "docker":
82
82
  return ExomiserCommandLineArguments(
83
- sample=f"{PHENOPACKET_TARGET_DIRECTORY_DOCKER}{Path(self.phenopacket_path.name)}",
83
+ sample=Path(f"{PHENOPACKET_TARGET_DIRECTORY_DOCKER}{self.phenopacket_path.name}"),
84
84
  variant_analysis=self.variant_analysis,
85
85
  output_options_file=(
86
- f"{OUTPUT_OPTIONS_TARGET_DIRECTORY_DOCKER}{Path(output_options_file).name}"
87
- if output_options_file is not None
86
+ Path(f"{OUTPUT_OPTIONS_TARGET_DIRECTORY_DOCKER}{output_options_file.name}")
87
+ if output_options_file
88
88
  else None
89
89
  ),
90
- raw_results_dir=RAW_RESULTS_TARGET_DIRECTORY_DOCKER,
90
+ raw_results_dir=Path(RAW_RESULTS_TARGET_DIRECTORY_DOCKER),
91
91
  output_formats=self.output_formats,
92
92
  )
93
93
  elif self.environment == "local":
94
94
  return ExomiserCommandLineArguments(
95
- sample=Path(self.phenopacket_path),
95
+ sample=self.phenopacket_path,
96
96
  variant_analysis=self.variant_analysis,
97
97
  output_options_file=output_options_file,
98
98
  raw_results_dir=self.results_dir,
99
99
  output_formats=self.output_formats,
100
100
  )
101
+ raise ValueError(f"Unknown environment: {self.environment}")
101
102
 
102
103
  def add_variant_analysis_arguments(self, vcf_dir: Path) -> ExomiserCommandLineArguments:
103
- vcf_file_data = (
104
- PhenopacketUtil(self.phenopacket).vcf_file_data(self.phenopacket_path, vcf_dir)
105
- if vcf_dir.exists()
106
- else [
104
+ if vcf_dir.exists():
105
+ vcf_file_data = PhenopacketUtil(self.phenopacket).vcf_file_data(
106
+ self.phenopacket_path, vcf_dir
107
+ )
108
+ else:
109
+ vcf_file_data = next(
107
110
  file
108
111
  for file in self.phenopacket.files
109
112
  if file.file_attributes["fileFormat"] == "vcf"
110
- ][0]
111
- )
113
+ )
112
114
  output_options_file = self.assign_output_options_file()
113
115
  if self.environment == "local":
114
116
  return ExomiserCommandLineArguments(
115
- sample=Path(self.phenopacket_path),
117
+ sample=self.phenopacket_path,
116
118
  vcf_file=Path(vcf_file_data.uri),
117
119
  vcf_assembly=vcf_file_data.file_attributes["genomeAssembly"],
118
120
  output_options_file=output_options_file,
@@ -123,18 +125,24 @@ class CommandCreator:
123
125
  )
124
126
  elif self.environment == "docker":
125
127
  return ExomiserCommandLineArguments(
126
- sample=f"{PHENOPACKET_TARGET_DIRECTORY_DOCKER}{Path(self.phenopacket_path.name)}",
127
- vcf_file=f"{VCF_TARGET_DIRECTORY_DOCKER}{Path(vcf_file_data.uri).name}",
128
+ sample=Path(f"{PHENOPACKET_TARGET_DIRECTORY_DOCKER}{self.phenopacket_path.name}"),
129
+ vcf_file=Path(f"{VCF_TARGET_DIRECTORY_DOCKER}{Path(vcf_file_data.uri).name}"),
128
130
  vcf_assembly=vcf_file_data.file_attributes["genomeAssembly"],
129
131
  output_options_file=(
130
- f"{OUTPUT_OPTIONS_TARGET_DIRECTORY_DOCKER}{Path(output_options_file).name}"
131
- if output_options_file is not None
132
+ Path(f"{OUTPUT_OPTIONS_TARGET_DIRECTORY_DOCKER}{output_options_file.name}")
133
+ if output_options_file
132
134
  else None
133
135
  ),
134
136
  variant_analysis=self.variant_analysis,
135
- raw_results_dir=RAW_RESULTS_TARGET_DIRECTORY_DOCKER,
136
- analysis_yaml=f"{EXOMISER_YAML_TARGET_DIRECTORY_DOCKER}{Path(self.analysis_yaml).name}",
137
+ raw_results_dir=Path(RAW_RESULTS_TARGET_DIRECTORY_DOCKER),
138
+ analysis_yaml=(
139
+ Path(f"{EXOMISER_YAML_TARGET_DIRECTORY_DOCKER}{self.analysis_yaml.name}")
140
+ if self.analysis_yaml
141
+ else None
142
+ ),
143
+ output_formats=self.output_formats,
137
144
  )
145
+ raise ValueError(f"Unknown environment: {self.environment}")
138
146
 
139
147
  def add_command_line_arguments(self, vcf_dir: Path or None) -> ExomiserCommandLineArguments:
140
148
  """Return a dataclass of all the command line arguments corresponding to phenopacket sample."""
@@ -187,86 +195,77 @@ class CommandsWriter:
187
195
 
188
196
  def write_basic_analysis_command(self, command_arguments: ExomiserCommandLineArguments):
189
197
  """Write basic analysis command for Exomiser"""
190
- try:
191
- self.file.write(
192
- "--analysis "
193
- + str(command_arguments.analysis_yaml)
194
- + " --sample "
195
- + str(command_arguments.sample)
196
- + " --vcf "
197
- + str(command_arguments.vcf_file)
198
- + " --assembly "
199
- + command_arguments.vcf_assembly
200
- + " --output-filename "
201
- + f"{command_arguments.sample.stem}-exomiser"
202
- )
203
- except IOError:
204
- print("Error writing ", self.file)
198
+ self.file.write(
199
+ "--analysis "
200
+ + str(command_arguments.analysis_yaml)
201
+ + " --sample "
202
+ + str(command_arguments.sample)
203
+ + " --vcf "
204
+ + str(command_arguments.vcf_file)
205
+ + " --assembly "
206
+ + command_arguments.vcf_assembly
207
+ + " --output-filename "
208
+ + f"{command_arguments.sample.stem}-exomiser"
209
+ )
205
210
 
206
211
  def write_results_dir(self, command_arguments: ExomiserCommandLineArguments) -> None:
207
212
  """Write results directory for exomiser ≥13.2.0 to run."""
208
- try:
209
- (
210
- self.file.write(" --output-directory " + str(command_arguments.raw_results_dir))
211
- if command_arguments.raw_results_dir is not None
212
- else None
213
- )
214
- except IOError:
215
- print("Error writing ", self.file)
213
+ (
214
+ self.file.write(" --output-directory " + str(command_arguments.raw_results_dir))
215
+ if command_arguments.raw_results_dir is not None
216
+ else None
217
+ )
216
218
 
217
219
  def write_output_options(self, command_arguments: ExomiserCommandLineArguments) -> None:
218
220
  """Write a command out for exomiser ≤13.1.0 to run - including output option file specified."""
219
- try:
220
- (
221
- self.file.write(" --output " + str(command_arguments.output_options_file))
222
- if command_arguments.output_options_file is not None
223
- else None
224
- )
225
- except IOError:
226
- print("Error writing ", self.file)
221
+ (
222
+ self.file.write(" --output " + str(command_arguments.output_options_file))
223
+ if command_arguments.output_options_file is not None
224
+ else None
225
+ )
227
226
 
228
227
  def write_output_format(self, command_arguments: ExomiserCommandLineArguments) -> None:
229
228
  """Write output formats for Exomiser raw result output."""
229
+ (
230
+ self.file.write(" --output-format " + ",".join(command_arguments.output_formats))
231
+ if command_arguments.output_formats is not None
232
+ else None
233
+ )
234
+
235
+ def write_analysis_command(self, command_arguments: ExomiserCommandLineArguments):
230
236
  try:
231
- (
232
- self.file.write(" --output-format " + ",".join(command_arguments.output_formats))
233
- if command_arguments.output_formats is not None
234
- else None
235
- )
237
+ self.write_basic_analysis_command(command_arguments)
238
+ self.write_results_dir(command_arguments)
239
+ self.write_output_options(command_arguments)
240
+ self.write_output_format(command_arguments)
241
+ self.file.write("\n")
236
242
  except IOError:
237
243
  print("Error writing ", self.file)
238
244
 
239
- def write_analysis_command(self, command_arguments: ExomiserCommandLineArguments):
240
- self.write_basic_analysis_command(command_arguments)
241
- self.write_results_dir(command_arguments)
242
- self.write_output_options(command_arguments)
243
- self.write_output_format(command_arguments)
244
- self.file.write("\n")
245
-
246
245
  def write_basic_phenotype_only_command(
247
246
  self, command_arguments: ExomiserCommandLineArguments
248
247
  ) -> None:
249
248
  """Write a phenotype-only command out for exomiser ≥13.2.0 to run."""
249
+ self.file.write(
250
+ "--sample "
251
+ + str(command_arguments.sample)
252
+ + " --output-directory "
253
+ + str(command_arguments.raw_results_dir)
254
+ + " --output-filename "
255
+ + f"{Path(command_arguments.sample).stem}-exomiser"
256
+ + " --preset "
257
+ + "phenotype-only"
258
+ )
259
+
260
+ def write_phenotype_only_command(self, command_arguments: ExomiserCommandLineArguments):
250
261
  try:
251
- self.file.write(
252
- "--sample "
253
- + str(command_arguments.sample)
254
- + " --output-directory "
255
- + str(command_arguments.raw_results_dir)
256
- + " --output-filename "
257
- + f"{Path(command_arguments.sample).stem}-exomiser"
258
- + " --preset "
259
- + "phenotype-only"
260
- )
262
+ self.write_basic_phenotype_only_command(command_arguments)
263
+ self.write_output_options(command_arguments)
264
+ self.write_output_format(command_arguments)
265
+ self.file.write("\n")
261
266
  except IOError:
262
267
  print("Error writing ", self.file)
263
268
 
264
- def write_phenotype_only_command(self, command_arguments: ExomiserCommandLineArguments):
265
- self.write_basic_phenotype_only_command(command_arguments)
266
- self.write_output_options(command_arguments)
267
- self.write_output_format(command_arguments)
268
- self.file.write("\n")
269
-
270
269
  def write_local_commands(self, command_arguments: ExomiserCommandLineArguments):
271
270
  (
272
271
  self.write_analysis_command(command_arguments)
@@ -403,19 +402,19 @@ def create_batch_file(
403
402
  )
404
403
  @click.option(
405
404
  "--phenopacket-dir",
406
- "-P",
405
+ "-p",
407
406
  required=True,
408
407
  metavar="PATH",
409
408
  type=Path,
410
- help="Path to phenopackets.",
409
+ help="Path to phenopacket directory.",
411
410
  )
412
411
  @click.option(
413
412
  "--vcf-dir",
414
413
  "-v",
415
- required=True,
414
+ # required=True,
416
415
  metavar="PATH",
417
416
  type=Path,
418
- help="Path to VCF files.",
417
+ help="Path to VCF directory.",
419
418
  )
420
419
  @click.option(
421
420
  "--batch-prefix",
@@ -437,15 +436,22 @@ def create_batch_file(
437
436
  help="Number of jobs in each file.",
438
437
  )
439
438
  @click.option(
440
- "--phenotype-only",
439
+ "--variant-analysis",
441
440
  type=bool,
442
441
  default=False,
443
- cls=MutuallyExclusiveOptionError,
444
- mutually_exclusive=["vcf_dir", "analysis_yaml"],
442
+ is_flag=True,
445
443
  help="Run Exomiser with phenotype only preset - strongly recommended to run with versions 13.2.0 onwards.",
446
444
  )
445
+ @click.option(
446
+ "--output-dir",
447
+ "-d",
448
+ type=Path,
449
+ required=False,
450
+ help="Results directory for Exomiser results - compatible with versions 13.2.0 onwards.",
451
+ )
447
452
  @click.option(
448
453
  "--results-dir",
454
+ "-r",
449
455
  type=Path,
450
456
  required=False,
451
457
  help="Results directory for Exomiser results - compatible with versions 13.2.0 onwards.",
@@ -470,29 +476,39 @@ def create_batch_file(
470
476
  type=Path,
471
477
  help="Path to the output options file. ",
472
478
  )
479
+ @click.option(
480
+ "--output-formats",
481
+ "-f",
482
+ multiple=True,
483
+ help="One or more output formats (e.g., --output-format vcf --output-format json).",
484
+ )
473
485
  def prepare_exomiser_batch(
474
486
  environment: str,
475
487
  analysis_yaml: Path,
476
488
  phenopacket_dir: Path,
477
489
  vcf_dir: Path,
478
490
  output_dir: Path,
491
+ results_dir: Path,
479
492
  batch_prefix: str,
480
493
  max_jobs: int,
481
- phenotype_only: bool,
494
+ variant_analysis: bool,
482
495
  output_options_dir: Path = None,
483
496
  output_options_file: Path = None,
497
+ output_formats: List[str] = None,
484
498
  ):
485
499
  """Generate Exomiser batch files."""
486
500
  Path(output_dir).joinpath("tool_input_commands").mkdir(exist_ok=True)
487
501
  create_batch_file(
488
- environment,
489
- analysis_yaml,
490
- phenopacket_dir,
491
- vcf_dir,
492
- output_dir,
493
- batch_prefix,
494
- max_jobs,
495
- phenotype_only,
496
- output_options_dir,
497
- output_options_file,
502
+ environment=environment,
503
+ analysis=analysis_yaml,
504
+ phenopacket_dir=phenopacket_dir,
505
+ vcf_dir=vcf_dir,
506
+ output_dir=output_dir,
507
+ results_dir=results_dir,
508
+ batch_prefix=batch_prefix,
509
+ max_jobs=max_jobs,
510
+ variant_analysis=variant_analysis,
511
+ output_options_dir=output_options_dir,
512
+ output_options_file=output_options_file,
513
+ output_formats=list(output_formats),
498
514
  )