about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-10-02 13:32:57 -0500
committerFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-10-02 13:32:57 -0500
commit2933f3c336d84fc18ef0367f4c501a852b0fd7a4 (patch)
tree783d5f9c6761ba911690847bcae89449444256e8 /scripts
parentd895a2ab507f72a04d1add6612f396288c8c25c7 (diff)
downloadgn-uploader-2933f3c336d84fc18ef0367f4c501a852b0fd7a4.tar.gz
Pre-process a transposed file.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/genotypes/preprocess_csv_collect_info.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/genotypes/preprocess_csv_collect_info.py b/scripts/genotypes/preprocess_csv_collect_info.py
index 6eb6cbc..06e7abd 100644
--- a/scripts/genotypes/preprocess_csv_collect_info.py
+++ b/scripts/genotypes/preprocess_csv_collect_info.py
@@ -69,10 +69,21 @@ def identify_columns(
 
 def process_transposed(
         line: tuple[str, ...],
-        na_strings: tuple[str, ...]
+        settings: dict,
 ) -> TransposedLineDetails:
     """Process a line in a transposed file."""
-    raise NotImplementedError("Please implement this!")
+    return TransposedLineDetails(
+        line_content=line,
+        geno_symbols=tuple(set(
+            line[1:] if line[0] not in (
+                settings["markers"],
+                settings["chromosome"],
+                settings["cm"],
+                settings["mb"])
+            else tuple())),
+        line_header=line[0],
+        errors=tuple(),
+        is_markers_line=line[0]==settings["markers"])
 
 
 def process_untransposed(
@@ -178,9 +189,7 @@ def file_statistics(filepath: Path, fileconfigs: dict) -> FileStats:
             continue# skip headers line
 
         if fileconfigs["transposed"]:
-            t_line_dets = process_transposed(
-                line,
-                na_strings=fileconfigs["na_strings"])
+            t_line_dets = process_transposed(line, fileconfigs)
             headers = headers + (t_line_dets.line_header,)
             genosymbols.update(t_line_dets.geno_symbols)
             _errors = _errors + tuple(t_line_dets.errors)