Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
seallard committed Dec 12, 2023
1 parent 71634c0 commit 0227515
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
1 change: 0 additions & 1 deletion cg/meta/workflow/microsalt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ class QualityMetrics(BaseModel):
class QualityResult(BaseModel):
sample_id: str
passed: bool
fail_message: str | None = None
16 changes: 15 additions & 1 deletion cg/meta/workflow/microsalt/quality_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,22 @@ def quality_control_sample(self, sample_id: str, metrics: SampleMetrics) -> Qual
valid_coverage: bool = self.is_valid_average_coverage(metrics)
valid_10x_coverage: bool = self.is_valid_10x_coverage(metrics)

sample_passes_qc: bool = (
valid_reads
and valid_mapping
and valid_duplication
and valid_inserts
and valid_coverage
and valid_10x_coverage
)

return QualityResult(
sample_id=sample_id,
passed=sample_passes_qc,
)

def quality_control_case(self, sample_results: list[QualityResult]) -> bool:
pass
negative_control_passes: bool = True

def microsalt_qc(self, case_id: str, run_dir_path: Path, lims_project: str) -> bool:
"""Check if given microSALT case passes QC check."""
Expand Down
12 changes: 3 additions & 9 deletions tests/meta/workflow/microsalt/test_quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ def test_sample_total_reads_passing():
target_reads = 100

# WHEN checking if the sample has sufficient reads
passes_reads_threshold = is_valid_total_reads(
reads=sample_reads, target_reads=target_reads
)
passes_reads_threshold = is_valid_total_reads(reads=sample_reads, target_reads=target_reads)

# THEN it passes
assert passes_reads_threshold
Expand All @@ -21,9 +19,7 @@ def test_sample_total_reads_failing():
target_reads = 100

# WHEN checking if the sample has sufficient reads
passes_reads_threshold = is_valid_total_reads(
reads=sample_reads, target_reads=target_reads
)
passes_reads_threshold = is_valid_total_reads(reads=sample_reads, target_reads=target_reads)

# THEN it fails
assert not passes_reads_threshold
Expand All @@ -35,9 +31,7 @@ def test_sample_total_reads_failing_without_reads():
target_reads = 100

# WHEN checking if the sample has sufficient reads
passes_reads_threshold = is_valid_total_reads(
reads=sample_reads, target_reads=target_reads
)
passes_reads_threshold = is_valid_total_reads(reads=sample_reads, target_reads=target_reads)

# THEN it fails
assert not passes_reads_threshold

0 comments on commit 0227515

Please sign in to comment.