about summary refs log tree commit diff
path: root/uploader/scripts/genotypes/types.py
diff options
context:
space:
mode:
authorpi coding agent <pi@localhost>2026-10-22 18:59:33 +0000
committerFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-10-22 14:25:09 -0500
commita897ceca02b78a9426652ac3092c79278cdc681c (patch)
tree1ed499d3c583c93890d30864871740a276e4f718 /uploader/scripts/genotypes/types.py
parente3859b3945606aed7bd6a3861af8a525e061a2b1 (diff)
downloadgn-uploader-a897ceca02b78a9426652ac3092c79278cdc681c.tar.gz
Move scripts into the uploader package
Move the top-level `scripts` package to `uploader/scripts` so that it becomes
the `uploader.scripts` package. All files are moved unchanged; references are
updated in a follow-up commit.
Diffstat (limited to 'uploader/scripts/genotypes/types.py')
-rw-r--r--uploader/scripts/genotypes/types.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/uploader/scripts/genotypes/types.py b/uploader/scripts/genotypes/types.py
new file mode 100644
index 0000000..d765fe5
--- /dev/null
+++ b/uploader/scripts/genotypes/types.py
@@ -0,0 +1,69 @@
+"""The datatypes this package will use."""
+from typing import Sequence, Optional
+from dataclasses import field, dataclass
+
+
+@dataclass
+class DotGenoFields:# Still necessary??
+    """Custom .geno file format values"""
+    name: str
+    mat: str
+    pat: str
+    het: str
+    type: Optional[str] = None
+    unk: Optional[str] = None
+
+
+@dataclass(frozen=True)
+class FieldsIdentity:
+    """Data type for identity of the fields."""
+    marker: str
+    chromosome: str
+    genetic_distance: str # cM
+    physical_distance: str # Mb
+    samples: Sequence[str]
+
+
+@dataclass
+class LineError:
+    """An error in a specific line of the genotype file."""
+    row_header: str
+    column_header: str
+    message: str
+    line: Sequence[str]
+
+
+@dataclass(frozen=True)
+class TransposedLineDetails:
+    """Data type for processed line details"""
+    line_content: Sequence[str]
+    geno_symbols: Sequence[str]
+    line_header: str
+    errors: Sequence[LineError]
+    is_markers_line: bool = False
+
+
+@dataclass(frozen=True)
+class UntransposedLineDetails:
+    """Data type for processed line details"""
+    line_content: Sequence[str]
+    geno_symbols: Sequence[str]
+    line_header: str
+    errors: Sequence[LineError]
+    marker: Optional[str] = None
+
+
+@dataclass(frozen=True)
+class FileStats:# pylint: disable=[too-many-instance-attributes]
+    """Custom file statistics."""
+    total_lines: int
+    data_lines: int
+    geno_symbols: Sequence[str]
+
+    comment_lines: int = 0
+    blank_lines: int = 0
+    dot_geno_lines: int = 0
+    dot_geno_fields: Optional[DotGenoFields] = None
+    samples_list: Sequence[str] = field(default_factory=tuple)
+    markers_list: Sequence[str] = field(default_factory=tuple)
+    errors: Sequence[LineError] = field(default_factory=tuple)