about summary refs log tree commit diff
path: root/scripts/genotypes/types.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-09-25 10:37:20 -0500
committerFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-09-28 09:47:36 -0500
commit5e4d6d5c5755fbe057d101b62f95208a3afa4ade (patch)
tree2688a73f0b4e1f2b8a30bcc5c6c8797c83390901 /scripts/genotypes/types.py
parentc590b5226e8e2f65e8ef85c77d4d24a8d423a4c4 (diff)
downloadgn-uploader-5e4d6d5c5755fbe057d101b62f95208a3afa4ade.tar.gz
Initialise scripts for genotype uploads files' processing.
Diffstat (limited to 'scripts/genotypes/types.py')
-rw-r--r--scripts/genotypes/types.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/scripts/genotypes/types.py b/scripts/genotypes/types.py
new file mode 100644
index 0000000..0ac335a
--- /dev/null
+++ b/scripts/genotypes/types.py
@@ -0,0 +1,58 @@
+"""The datatypes this package will use."""
+from dataclasses import dataclass
+from typing import Sequence, Optional
+
+
+@dataclass
+class DotGenoFields:
+    """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(frozen=True)
+class LineDetails:
+    """Data type for processed line details"""
+    line_content: Sequence[Union[str, None]]
+    geno_symbols: Sequence[str]
+    line_header: Optional[str] = None
+
+
+@dataclass(frozen=True)
+class LineError:
+    """An error object for a line."""
+    marker: str
+    field: str
+    value: Union[str, None]
+    message: str
+
+
+@dataclass(frozen=True)
+class FileStats:
+    """Custom file statistics."""
+    data_lines: int
+    total_lines: int
+    geno_symbols: Sequence[str]
+
+    blank_lines: int = 0
+    comment_lines: int = 0
+    dot_geno_lines: int = 0
+    dot_geno_fields: Optional[DotGenoFields] = None
+    samples: Sequence[str] = field(default_factory=tuple)
+    samples_list: Sequence[str] = field(default_factory=tuple)
+    markers_list: Sequence[str] = field(default_factory=tuple)
+    errors: Sequence[LineError] = field(default_factory=tuple)