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

add exome flag to exome samples #3061

Merged
merged 26 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
19 changes: 17 additions & 2 deletions cg/meta/workflow/balsamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import logging
from pathlib import Path
from typing import Optional
mathiasbio marked this conversation as resolved.
Show resolved Hide resolved

from housekeeper.store.models import File, Version
from pydantic.v1 import EmailStr, ValidationError

from cg.constants import Workflow
from cg.constants.constants import FileFormat, SampleType
from cg.constants.constants import FileFormat, SampleType, AnalysisType
from cg.constants.housekeeper_tags import BalsamicAnalysisTag
from cg.constants.observations import ObservationsFileWildcards
from cg.constants.priority import SlurmQos
Expand Down Expand Up @@ -278,6 +279,12 @@ def get_verified_sex(sample_data: dict) -> Sex:
LOG.error(f"Unable to retrieve a valid sex from samples: {sample_data.keys()}")
raise BalsamicStartError

def get_exome_argument_if_exome_sample(self, case_id: str) -> bool:
mathiasbio marked this conversation as resolved.
Show resolved Hide resolved
"""Returns the exome argument if the application type in sample_data is wes."""
mathiasbio marked this conversation as resolved.
Show resolved Hide resolved
application_type: str = self.get_case_application_type(case_id)
if application_type == AnalysisType.WHOLE_EXOME_SEQUENCING:
return True
mathiasbio marked this conversation as resolved.
Show resolved Hide resolved

def get_verified_samples(self, case_id: str) -> dict[str, str]:
"""Return a verified tumor and normal sample dictionary."""
tumor_samples: list[Sample] = self.status_db.get_samples_by_type(
Expand Down Expand Up @@ -454,6 +461,10 @@ def get_verified_config_case_arguments(
)
verified_sex: Sex = sex or self.get_verified_sex(sample_data=sample_data)

verified_exome_argument: Optional[bool] = self.get_exome_argument_if_exome_sample(
mathiasbio marked this conversation as resolved.
Show resolved Hide resolved
case_id=case_id
)

config_case: dict[str, str] = {
"case_id": case_id,
"analysis_workflow": self.workflow,
Expand All @@ -463,7 +474,9 @@ def get_verified_config_case_arguments(
"pon_cnn": verified_pon,
"swegen_snv": self.get_swegen_verified_path(Variants.SNV),
"swegen_sv": self.get_swegen_verified_path(Variants.SV),
"exome": verified_exome_argument,
}

config_case.update(self.get_verified_samples(case_id=case_id))
config_case.update(self.get_parsed_observation_file_paths(observations))
(
Expand Down Expand Up @@ -580,12 +593,14 @@ def config_case(
"--gnomad-min-af5": arguments.get("gnomad_min_af5"),
"--normal-sample-name": arguments.get("normal_sample_name"),
"--panel-bed": arguments.get("panel_bed"),
"--exome": arguments.get("exome"),
"--pon-cnn": arguments.get("pon_cnn"),
"--swegen-snv": arguments.get("swegen_snv"),
"--swegen-sv": arguments.get("swegen_sv"),
"--tumor-sample-name": arguments.get("tumor_sample_name"),
"--umi-trim-length": arguments.get("umi_trim_length"),
}
},
exclude_true=True,
)
parameters = command + options
self.process.run_command(parameters=parameters, dry_run=dry_run)
Expand Down
1 change: 1 addition & 0 deletions tests/meta/workflow/test_balsamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytest

from cg.constants.constants import AnalysisType
mathiasbio marked this conversation as resolved.
Show resolved Hide resolved
from cg.constants.observations import ObservationsFileWildcards
from cg.constants.sequencing import Variants
from cg.constants.subject import Sex
Expand Down
Loading