-
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.
Merge branch 'master' into add_scout_for_tomte
- Loading branch information
Showing
30 changed files
with
1,646 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__title__ = "cg" | ||
__version__ = "62.1.11" | ||
__version__ = "62.2.0" |
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.