Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parsing snappy config for with WGS projects #231

Merged
merged 4 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading