Skip to content

Commit

Permalink
fix: parsing snappy config for with WGS projects (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolai-vKuegelgen authored Apr 30, 2024
1 parent 3fc38af commit 10592f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
15 changes: 11 additions & 4 deletions cubi_tk/snappy/itransfer_sv_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@


class SnappyStepNotFoundException(Exception):
def __str__(self):
return "snappy-pipeline config does not define the expected steps this function needs."
"""Raise when snappy-pipeline config does not define the expected steps this function needs."""


class SnappyItransferSvCallingCommand(IndexLibrariesOnlyMixin, SnappyItransferCommandBase):
"""Implementation of snappy itransfer command for variant calling results."""

fix_md5_files = True
command_name = "itransfer-sv-calling"
step_names = ("sv_calling", "sv_calling_targeted")
step_names = ("sv_calling_wgs", "sv_calling_targeted")
start_batch_in_family = True

def __init__(self, args):
Expand All @@ -46,7 +45,15 @@ def __init__(self, args):
f"Could not find any sv-calling step name in 'config.yaml'. Was looking for one of: {', '.join(self.__class__.step_names)}"
)

self.defined_callers = config["step_config"][self.step_name]["tools"]
if self.step_name == "sv_calling_targeted":
self.defined_callers = config["step_config"][self.step_name]["tools"]
else: # if self.step_name == 'sv_calling_wgs'
# For WGS config looks like: sv_calling_wgs::tools::<dna>::[...]
self.defined_callers = [
tool
for subcat in config["step_config"][self.step_name]["tools"]
for tool in config["step_config"][self.step_name]["tools"][subcat]
]

@classmethod
def setup_argparse(cls, parser: argparse.ArgumentParser) -> None:
Expand Down
9 changes: 5 additions & 4 deletions tests/test_snappy_itransfer_sv_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ def fake_config(n_tools=1):

tool2 = textwrap.dedent(
r"""
sv_calling:
tools:
- gcnv
- manta
sv_calling_wgs:
dna:
tools:
- gcnv
- manta
dummy_line
"""
).rstrip("dummy_line\n")
Expand Down

0 comments on commit 10592f3

Please sign in to comment.