Skip to content

Commit

Permalink
adding gene analysis and variant analysis arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
yaseminbridges committed Sep 21, 2023
1 parent e0d62db commit 6cb83eb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
18 changes: 6 additions & 12 deletions src/pheval_lirical/run/run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import subprocess
from pathlib import Path

Expand All @@ -15,18 +14,12 @@ def prepare_lirical_commands(
testdata_dir: Path,
lirical_version: str,
tool_specific_configurations: LIRICALToolSpecificConfigurations,
gene_analysis: bool,
variant_analysis: bool,
):
"""Write commands to run LIRICAL."""
phenopacket_dir = Path(testdata_dir).joinpath(
[
directory
for directory in os.listdir(str(testdata_dir))
if "phenopacket" in str(directory)
][0]
)
vcf_dir = Path(testdata_dir).joinpath(
[directory for directory in os.listdir(str(testdata_dir)) if "vcf" in str(directory)][0]
)
phenopacket_dir = Path(testdata_dir).joinpath("phenopackets")
vcf_dir = Path(testdata_dir).joinpath("vcf") if gene_analysis or variant_analysis else None
prepare_commands(
lirical_jar=input_dir.joinpath(tool_specific_configurations.lirical_jar_executable),
input_dir=input_dir.joinpath("data"),
Expand All @@ -46,14 +39,15 @@ def prepare_lirical_commands(
tool_specific_configurations.exomiser_db_configurations.exomiser_hg19_database
)
if tool_specific_configurations.exomiser_db_configurations.exomiser_hg19_database
is not None
else None,
exomiser_hg38_data=input_dir.joinpath(
tool_specific_configurations.exomiser_db_configurations.exomiser_hg38_database
)
if tool_specific_configurations.exomiser_db_configurations.exomiser_hg38_database
is not None
else None,
gene_analysis=gene_analysis,
variant_analysis=variant_analysis,
),


Expand Down
4 changes: 4 additions & 0 deletions src/pheval_lirical/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def run(self):
tool_input_commands_dir=self.tool_input_commands_dir,
lirical_version=self.version,
tool_specific_configurations=config,
gene_analysis=self.input_dir_config.gene_analysis,
variant_analysis=self.input_dir_config.variant_analysis,
)
run_lirical_local(
testdata_dir=self.testdata_dir, tool_input_commands_dir=self.tool_input_commands_dir
Expand All @@ -53,4 +55,6 @@ def post_process(self):
output_dir=self.output_dir,
config=config,
disease_analysis=self.input_dir_config.disease_analysis,
gene_analysis=self.input_dir_config.gene_analysis,
variant_analysis=self.input_dir_config.variant_analysis,
)
20 changes: 15 additions & 5 deletions tests/test_prepare_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ def test_get_vcf_assembly(self):

def test_add_manual_cli_arguments(self):
self.assertEqual(
self.command_creator.add_manual_cli_arguments(),
self.command_creator.add_manual_cli_arguments(
gene_analysis=True, variant_analysis=False
),
LiricalManualCommandLineArguments(
lirical_jar_file=Path("/path/to/lirical.jar"),
observed_phenotypes=[
Expand All @@ -234,7 +236,9 @@ def test_add_manual_cli_arguments(self):

def test_add_manual_cli_arguments_none_excluded(self):
self.assertEqual(
self.command_creator_none_excluded.add_manual_cli_arguments(),
self.command_creator_none_excluded.add_manual_cli_arguments(
gene_analysis=True, variant_analysis=False
),
LiricalManualCommandLineArguments(
lirical_jar_file=Path("/path/to/lirical.jar"),
observed_phenotypes=[
Expand All @@ -259,7 +263,9 @@ def test_add_phenopacket_cli_arguments(self):
phenopacket_command_creator = copy(self.command_creator)
phenopacket_command_creator.mode = "phenopacket"
self.assertEqual(
phenopacket_command_creator.add_phenopacket_cli_arguments(),
phenopacket_command_creator.add_phenopacket_cli_arguments(
gene_analysis=False, variant_analysis=True
),
LiricalPhenopacketCommandLineArguments(
lirical_jar_file=Path("/path/to/lirical.jar"),
phenopacket_path=Path("/path/to/phenopacket.json"),
Expand All @@ -278,7 +284,9 @@ def test_add_cli_arguments(self):
phenopacket_command_creator = copy(self.command_creator)
phenopacket_command_creator.mode = "phenopacket"
self.assertEqual(
phenopacket_command_creator.add_cli_arguments(),
phenopacket_command_creator.add_cli_arguments(
gene_analysis=True, variant_analysis=True
),
LiricalPhenopacketCommandLineArguments(
lirical_jar_file=Path("/path/to/lirical.jar"),
phenopacket_path=Path("/path/to/phenopacket.json"),
Expand All @@ -294,7 +302,9 @@ def test_add_cli_arguments(self):
)

self.assertEqual(
self.command_creator_none_excluded.add_cli_arguments(),
self.command_creator_none_excluded.add_cli_arguments(
gene_analysis=True, variant_analysis=True
),
LiricalManualCommandLineArguments(
lirical_jar_file=Path("/path/to/lirical.jar"),
observed_phenotypes=[
Expand Down

0 comments on commit 6cb83eb

Please sign in to comment.