Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: astral-sh/setup-uv@v5
with:
# Install a specific version of uv and enable caching.
version: "0.6.2"
version: "0.7.2"
enable-cache: true

- name: Set up Python
Expand All @@ -39,7 +39,7 @@ jobs:
run: uv run ruff format --check

- name: Run mypy
run: uv run mypy src
run: uv run pyrefly check

- name: Run pytest
run: uv run pytest
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Changelog = "https://github.com/BfArM-MVH/grz-pydantic-models/commits/main"
[dependency-groups]
dev = [
"ruff >=0.11.0,<0.12",
"mypy >=1.13.0",
"pyrefly >=0.13.0,<0.14.0",
"pytest == 8.*"
]

Expand All @@ -52,3 +52,6 @@ fixable = [
select = [
"I"
]

[tool.pyrefly]
search_path = ["src"]
14 changes: 7 additions & 7 deletions src/grz_pydantic_models/pruefbericht/v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
class DataCategory(enum.StrEnum):
"""Type of submission."""

clinical = enum.auto()
genomic = enum.auto()
clinical = "clinical"
genomic = "genomic"


class LibraryType(enum.StrEnum):
"""Sequencing method, if applicable."""

panel = enum.auto()
wes = enum.auto()
wgs = enum.auto()
wgs_lr = enum.auto()
none = enum.auto()
panel = "panel"
wes = "wes"
wgs = "wgs"
wgs_lr = "wgs_lr"
none = "none"


class SubmittedCase(StrictBaseModel):
Expand Down
Empty file.
14 changes: 7 additions & 7 deletions src/grz_pydantic_models/submission/metadata/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class Donor(StrictBaseModel):
@model_validator(mode="after")
def warn_empty_sequence_data(self):
for lab_datum in self.lab_data:
if not lab_datum.has_sequence_data():
if lab_datum.sequence_data is None:
Comment thread
tedil marked this conversation as resolved.
log.warning(
f"No sequence data found for lab datum '{lab_datum.lab_data_name}' in donor '{self.donor_pseudonym}'. "
"Is this a submission without sequence data?"
Expand All @@ -750,7 +750,7 @@ def validate_target_bed_files_exist(self):

for lab_datum in self.lab_data:
if (
lab_datum.has_sequence_data()
lab_datum.sequence_data is not None
and lab_datum.library_type in lib_types
and not lab_datum.sequence_data.contains_files(FileType.bed)
):
Expand All @@ -766,7 +766,7 @@ def validate_vcf_file_exists(self):
Check if there is a VCF file
"""
for lab_datum in self.lab_data:
if lab_datum.has_sequence_data() and not lab_datum.sequence_data.contains_files(FileType.vcf):
if lab_datum.sequence_data is not None and not lab_datum.sequence_data.contains_files(FileType.vcf):
raise ValueError(
f"VCF file missing for lab datum '{lab_datum.lab_data_name}' in donor '{self.donor_pseudonym}'."
)
Expand All @@ -779,7 +779,7 @@ def validate_sequencing_file_exists(self): # noqa: C901
Check if there is a FASTQ or BAM file (depending on library type)
"""
for lab_datum in self.lab_data:
if not lab_datum.has_sequence_data():
if lab_datum.sequence_data is None:
# Skip if no sequence data is present
continue
fastq_files = lab_datum.sequence_data.list_files(FileType.fastq)
Expand Down Expand Up @@ -957,6 +957,7 @@ def validate_reference_genome_compatibility(self):
(donor.donor_pseudonym, lab_datum.lab_data_name): lab_datum.sequence_data.reference_genome
for donor in self.donors
for lab_datum in donor.lab_data
if lab_datum.sequence_data is not None
}
unique_reference_genomes = set(reference_genomes.values())
if len(unique_reference_genomes) > 1:
Expand All @@ -970,13 +971,12 @@ def validate_reference_genome_compatibility(self):


def _check_thresholds(donor: Donor, lab_datum: LabDatum, thresholds: dict[str, Any]):
if not lab_datum.has_sequence_data():
if lab_datum.sequence_data is None:
# Skip if no sequence data is present; warning issues in the validator `warn_empty_sequence_data` of `Donor`.
return
pseudonym = donor.donor_pseudonym
lab_data_name = lab_datum.lab_data_name
# mypy cannot reason about the `has_sequence_data` check
sequence_data = typing.cast(SequenceData, lab_datum.sequence_data)
sequence_data = lab_datum.sequence_data

mean_depth_of_coverage_t = thresholds.get("meanDepthOfCoverage")
mean_depth_of_coverage_v = sequence_data.mean_depth_of_coverage
Expand Down
Loading