-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Added - Added property `is_negative_control` to `Sample` model. - Defined a mutant specific `store-available` function that calls `run_qc_and_fail_analyses()` - `run_qc_and_fail_analyses()` performs qc on a case, generates a qc_report file, adds qc summary to the comment on the analyses on trailblazer and sets analyses that fail QC as failed on Trailblazer. - CLI `run-qc` command to manually run QC on case and generate qc_report file. ### Changed - `MockLimsApi` to have more functionalities for testing.
- Loading branch information
1 parent
e663e09
commit 534bf8d
Showing
27 changed files
with
1,643 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from cg.meta.workflow.mutant.mutant import MutantAnalysisAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from cg.meta.workflow.mutant.quality_controller.quality_controller import MutantQualityController |
50 changes: 50 additions & 0 deletions
50
cg/meta/workflow/mutant/quality_controller/metrics_parser_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from pathlib import Path | ||
|
||
from pydantic import TypeAdapter | ||
from cg.io.csv import read_csv | ||
from typing import Any | ||
|
||
from cg.meta.workflow.mutant.quality_controller.models import ParsedSampleResults | ||
from cg.store.models import Case | ||
|
||
|
||
def parse_samples_results(case: Case, results_file_path: Path) -> dict[str, ParsedSampleResults]: | ||
"""Takes a case object and a results_file_path and resturns dict[str, SampleResults] with sample.internal_id as keys.""" | ||
|
||
validated_results_list: list[ParsedSampleResults] = _get_validated_results_list( | ||
results_file_path=results_file_path | ||
) | ||
|
||
samples_results: dict[str, ParsedSampleResults] = _get_samples_results( | ||
case=case, results_list=validated_results_list | ||
) | ||
|
||
return samples_results | ||
|
||
|
||
def _get_validated_results_list(results_file_path: Path) -> list[ParsedSampleResults]: | ||
"""Parses the results file and returns a list of validated SampleResults.""" | ||
raw_results: list[dict[Any, Any]] = read_csv(file_path=results_file_path, read_to_dict=True) | ||
adapter = TypeAdapter(list[ParsedSampleResults]) | ||
return adapter.validate_python(raw_results) | ||
|
||
|
||
def _get_sample_name_to_id_mapping(case: Case) -> dict[str, str]: | ||
sample_name_to_id_mapping: dict[str, str] = {} | ||
for sample in case.samples: | ||
sample_name_to_id_mapping[sample.name] = sample.internal_id | ||
return sample_name_to_id_mapping | ||
|
||
|
||
def _get_samples_results( | ||
case: Case, results_list: list[ParsedSampleResults] | ||
) -> dict[str, ParsedSampleResults]: | ||
"""Return the mapping of sample internal ids to SampleResults for a case.""" | ||
|
||
sample_name_to_id_mapping: dict[str, str] = _get_sample_name_to_id_mapping(case=case) | ||
|
||
samples_results: dict[str, ParsedSampleResults] = {} | ||
for result in results_list: | ||
sample_internal_id = sample_name_to_id_mapping[result.sample_name] | ||
samples_results[sample_internal_id] = result | ||
return samples_results |
Oops, something went wrong.