diff --git a/CHANGELOG.md b/CHANGELOG.md index 657bf3ff..f4a2272d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Avoid MySQLdb.OperationalError `Server has gone away` by modifying by setting `pool_pre_ping=True` when creating the engine - Coverage report screenshot displayed on README page and on the documenattion to reflect true statistics from the demo samples - Coverage report/overview page crashing when transcripts or exons intervals are required only genes are loaded +- Coverage overview over a gene should return transcript statistics if D4 file contains WGS data ## [1.5] ### Added diff --git a/src/chanjo2/models/pydantic_models.py b/src/chanjo2/models/pydantic_models.py index d3192864..76a41da2 100644 --- a/src/chanjo2/models/pydantic_models.py +++ b/src/chanjo2/models/pydantic_models.py @@ -272,6 +272,13 @@ def coverage_thresholds_validator(cls, completeness_thresholds: str): thresholds: List[str] = completeness_thresholds.split(",") return [int(threshold.strip()) for threshold in thresholds] + @field_validator("interval_type", mode="before") + def interval_type_validator(cls, interval_type: IntervalType) -> IntervalType: + """Make sure that gene stats include transcript data even if it's a WGS analysis.""" + if interval_type == IntervalType.GENES: + return IntervalType.TRANSCRIPTS + return interval_type + class SampleSexRow(BaseModel): sample: str