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

feat: (#405) somatic variant qc #407

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
22 changes: 8 additions & 14 deletions snappy_pipeline/workflows/somatic_variant_checking/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from biomedsheets.shortcuts import CancerCaseSheet, CancerCaseSheetOptions, is_not_background
from snakemake.io import expand

from snappy_pipeline.base import UnsupportedActionException
from snappy_pipeline.utils import dictify, listify
from snappy_pipeline.workflows.abstract import BaseStep, BaseStepPart, LinkOutStepPart
from snappy_pipeline.workflows.ngs_mapping import NgsMappingWorkflow, ResourceUsage
Expand All @@ -27,10 +26,11 @@
tools_ngs_mapping: [] # default to those configured for ngs_mapping
tools_somatic_variant_calling: [] # default to those configured for somatic_variant_calling
target_regions: # REQUIRED
padding: 0 #Used for count the number of variants outside of exom + padding
ignore_regions: []
minimal_support_read: 1
limited_support_read: 5
padding: 0 # Used for count the number of variants outside of exom + padding
AF_ID: 'AF' # REQUIRED ID of allele frequency field used in vcf file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider more explicit names, for example variant_allele_frequency_id

ignore_regions: "" # hard mapping regions
minimal_support_read: 1 # threshold for defining a variant that has minimal support reads
limited_support_read: 5 # threshold for defining a variant that has limited support reads
"""


Expand Down Expand Up @@ -76,7 +76,7 @@ def get_output_files(self, action):

@dictify
def _get_log_file(self, action):
assert action == "run"
self._validate_action(action=action)
prefix = (
"work/{mapper}.{var_caller}.variantsqc.{tumor_library}/log/"
"{mapper}.{var_caller}.variantsqc.{tumor_library}"
Expand All @@ -97,10 +97,7 @@ def get_resource_usage(self, action):
:return: Returns ResourceUsage for step.
:raises UnsupportedActionException: if action not in class defined list of valid actions.
"""
if action not in self.actions:
actions_str = ", ".join(self.actions)
error_message = f"Action '{action}' is not supported. Valid options: {actions_str}"
raise UnsupportedActionException(error_message)
self._validate_action(action=action)
mem_mb = 4 * 1024 # 4GB
return ResourceUsage(
threads=2,
Expand Down Expand Up @@ -189,10 +186,7 @@ def _yield_result_files_matched(self, tpl, **kwargs):
"""
for sheet in filter(is_not_background, self.shortcut_sheets):
for sample_pair in sheet.all_sample_pairs:
if (
not sample_pair.tumor_sample.dna_ngs_library
or not sample_pair.normal_sample.dna_ngs_library
):
if not sample_pair.tumor_sample.dna_ngs_library:
msg = (
"INFO: sample pair for cancer bio sample {} has is missing primary"
"normal or primary cancer NGS library"
Expand Down
64 changes: 0 additions & 64 deletions snappy_pipeline/workflows/somatic_variant_qc/Snakefile
giacuong171 marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

223 changes: 0 additions & 223 deletions snappy_pipeline/workflows/somatic_variant_qc/__init__.py
giacuong171 marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

17 changes: 9 additions & 8 deletions snappy_pipeline/workflows/tumor_mutational_burden/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
from biomedsheets.shortcuts import CancerCaseSheet, CancerCaseSheetOptions, is_not_background
from snakemake.io import expand

from snappy_pipeline.base import UnsupportedActionException
from snappy_pipeline.utils import dictify, listify
from snappy_pipeline.workflows.abstract import BaseStep, BaseStepPart, LinkOutStepPart
from snappy_pipeline.workflows.ngs_mapping import NgsMappingWorkflow, ResourceUsage
from snappy_pipeline.workflows.abstract import (
BaseStep,
BaseStepPart,
LinkOutStepPart,
ResourceUsage,
)
from snappy_pipeline.workflows.ngs_mapping import NgsMappingWorkflow
from snappy_pipeline.workflows.somatic_variant_calling import (
SOMATIC_VARIANT_CALLERS_MATCHED,
SomaticVariantCallingWorkflow,
Expand Down Expand Up @@ -80,7 +84,7 @@ def get_output_files(self, action):

@dictify
def _get_log_file(self, action):
assert action == "run"
self._validate_action(action)
prefix = (
"work/{mapper}.{var_caller}.tmb.{tumor_library}/log/"
"{mapper}.{var_caller}.tmb.{tumor_library}"
Expand All @@ -101,10 +105,7 @@ def get_resource_usage(self, action):
:return: Returns ResourceUsage for step.
:raises UnsupportedActionException: if action not in class defined list of valid actions.
"""
if action not in self.actions:
actions_str = ", ".join(self.actions)
error_message = f"Action '{action}' is not supported. Valid options: {actions_str}"
raise UnsupportedActionException(error_message)
self._validate_action(action)
mem_mb = 4 * 1024 # 4GB
return ResourceUsage(
threads=2,
Expand Down
Loading