about summary refs log tree commit diff
path: root/uploader/scripts
diff options
context:
space:
mode:
authorpi coding agent <pi@localhost>2026-11-04 19:59:33 +0000
committerFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-11-04 14:19:50 -0600
commit539f8baf47c428884aeb68fb5fe34830d5bf5435 (patch)
tree74108f94984289a0936ec177812509f54c63a804 /uploader/scripts
parent99a27b11db3f121bfbf3dc4118a68e60f710bb98 (diff)
downloadgn-uploader-539f8baf47c428884aeb68fb5fe34830d5bf5435.tar.gz
Move genotype data types into the uploader.genotypes package
Move `uploader/scripts/genotypes/types.py` to `uploader/genotypes/types.py` so
application code can use `FileStats` and friends without importing from
`uploader.scripts`. Update the collector script and tests to the new location.
Diffstat (limited to 'uploader/scripts')
-rw-r--r--uploader/scripts/genotypes/preprocess_csv_collect_info.py2
-rw-r--r--uploader/scripts/genotypes/types.py70
2 files changed, 1 insertions, 71 deletions
diff --git a/uploader/scripts/genotypes/preprocess_csv_collect_info.py b/uploader/scripts/genotypes/preprocess_csv_collect_info.py
index e1978bd..db2fbad 100644
--- a/uploader/scripts/genotypes/preprocess_csv_collect_info.py
+++ b/uploader/scripts/genotypes/preprocess_csv_collect_info.py
@@ -20,7 +20,7 @@ from uploader.scripts.cli.options import add_logging
 from uploader.scripts.cli.logging import setup_logging
 from uploader.scripts.cli.validators import file_exists
 
-from .types import (FileStats,
+from uploader.genotypes.types import (FileStats,
                     LineError,
                     DotGenoFields,
                     FieldsIdentity,
diff --git a/uploader/scripts/genotypes/types.py b/uploader/scripts/genotypes/types.py
deleted file mode 100644
index 4403f3d..0000000
--- a/uploader/scripts/genotypes/types.py
+++ /dev/null
@@ -1,70 +0,0 @@
-"""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)
-    description: str = ""