-
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.
Add automatic quality control of analyses for microbial samples (#2754)…
…(minor)
- Loading branch information
Showing
24 changed files
with
1,327 additions
and
303 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from cg.meta.workflow.microsalt.microsalt import MicrosaltAnalysisAPI |
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,4 @@ | ||
from cg.constants.constants import FileExtensions | ||
|
||
|
||
QUALITY_REPORT_FILE_NAME: str = f"QC_done{FileExtensions.JSON}" |
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,2 @@ | ||
from cg.meta.workflow.microsalt.metrics_parser.metrics_parser import MetricsParser | ||
from cg.meta.workflow.microsalt.metrics_parser.models import QualityMetrics, SampleMetrics |
12 changes: 12 additions & 0 deletions
12
cg/meta/workflow/microsalt/metrics_parser/metrics_parser.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,12 @@ | ||
from pathlib import Path | ||
|
||
from cg.io.json import read_json | ||
from cg.meta.workflow.microsalt.metrics_parser.models import QualityMetrics | ||
|
||
|
||
class MetricsParser: | ||
@staticmethod | ||
def parse(file_path: Path) -> QualityMetrics: | ||
data = read_json(file_path) | ||
formatted_data = {"samples": data} | ||
return QualityMetrics.model_validate(formatted_data) |
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,27 @@ | ||
from typing import Annotated | ||
from pydantic import BaseModel, BeforeValidator | ||
|
||
|
||
def empty_str_to_none(v: str) -> str | None: | ||
return v or None | ||
|
||
|
||
class PicardMarkduplicate(BaseModel): | ||
insert_size: Annotated[int | None, BeforeValidator(empty_str_to_none)] | ||
duplication_rate: Annotated[float | None, BeforeValidator(empty_str_to_none)] | ||
|
||
|
||
class MicrosaltSamtoolsStats(BaseModel): | ||
total_reads: Annotated[int | None, BeforeValidator(empty_str_to_none)] | ||
mapped_rate: Annotated[float | None, BeforeValidator(empty_str_to_none)] | ||
average_coverage: Annotated[float | None, BeforeValidator(empty_str_to_none)] | ||
coverage_10x: Annotated[float | None, BeforeValidator(empty_str_to_none)] | ||
|
||
|
||
class SampleMetrics(BaseModel): | ||
picard_markduplicate: PicardMarkduplicate | ||
microsalt_samtools_stats: MicrosaltSamtoolsStats | ||
|
||
|
||
class QualityMetrics(BaseModel): | ||
samples: dict[str, SampleMetrics] |
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.microsalt.quality_controller.quality_controller import QualityController |
Oops, something went wrong.