Skip to content

Commit

Permalink
Add qc for non microbial samples in microsalt (#2825)(patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
seallard authored Jan 12, 2024
1 parent 6dc497a commit cc3dae6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cg/meta/upload/microsalt/microsalt_upload_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, config: CGConfig):
super().__init__(config=config, analysis_api=self.analysis_api)

def upload(self, ctx: click.Context, case: Case, restart: bool) -> None:
"""Uploads MIP-DNA analysis data and files."""
"""Uploads MicroSALT analysis data and files."""
analysis: Analysis = case.analyses[0]
self.update_upload_started_at(analysis)

Expand Down
4 changes: 1 addition & 3 deletions cg/meta/workflow/microsalt/quality_controller/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from pydantic import BaseModel

from cg.constants.constants import MicrosaltAppTags


class SampleQualityResult(BaseModel):
sample_id: str
passes_qc: bool
is_control: bool
application_tag: MicrosaltAppTags
application_tag: str
passes_reads_qc: bool
passes_mapping_qc: bool = True
passes_duplication_qc: bool = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
get_percent_reads_guaranteed,
get_report_path,
get_sample_target_reads,
has_non_microbial_apptag,
is_sample_negative_control,
has_valid_10x_coverage,
has_valid_average_coverage,
Expand Down Expand Up @@ -83,6 +84,9 @@ def quality_control_sample(self, sample_id: str, metrics: SampleMetrics) -> Samp
and valid_10x_coverage
)

if has_non_microbial_apptag(sample):
sample_passes_qc = True

sample_quality = SampleQualityResult(
sample_id=sample_id,
passes_qc=sample_passes_qc,
Expand Down
5 changes: 5 additions & 0 deletions cg/meta/workflow/microsalt/quality_controller/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def has_valid_10x_coverage(metrics: SampleMetrics) -> bool:
return is_valid_10x_coverage(coverage_10x) if coverage_10x else False


def has_non_microbial_apptag(sample: Sample) -> bool:
app_tag: str = get_application_tag(sample)
return app_tag not in list(MicrosaltAppTags)


def get_negative_control_result(results: list[SampleQualityResult]) -> SampleQualityResult | None:
for result in results:
if result.is_control:
Expand Down

0 comments on commit cc3dae6

Please sign in to comment.