about summary refs log tree commit diff
path: root/scripts/genotypes
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/genotypes')
-rw-r--r--scripts/genotypes/preprocess_csv_collect_info.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/scripts/genotypes/preprocess_csv_collect_info.py b/scripts/genotypes/preprocess_csv_collect_info.py
index 771c11d..eaad1d7 100644
--- a/scripts/genotypes/preprocess_csv_collect_info.py
+++ b/scripts/genotypes/preprocess_csv_collect_info.py
@@ -51,7 +51,7 @@ def identify_columns(
     return FieldsIdentity(**_id)
 
 
-def process_transposed(line: tuple[str, ...]) -> LineDetails:
+def process_transposed(line: tuple[str, ...], na_strings: tuple[str, ...]) -> LineDetails:
     """Process a line in a transposed file."""
     raise NotImplementedError("Please implement this!")
 
@@ -96,7 +96,7 @@ def file_statistics(lines: Iterator[str], fileconfigs: dict) -> FileStats:
         if _line.startswith("@"): # custom GeneNetwork Settings
             stats["dot_geno_lines"] = stats.get("dot_geno_lines", 0) + 1
             _fld = tuple(item.strip() for item in line.strip("@").split(":"))
-            dot_geno[_fld[0]] = dot_geno[_fld[1]]
+            dotgeno[_fld[0]] = _fld[1]
             continue
 
         stats["data_lines"] = stats.get("data_lines", 0) + 1
@@ -123,14 +123,12 @@ def file_statistics(lines: Iterator[str], fileconfigs: dict) -> FileStats:
         line_dets = (
         process_transposed(
             fields,
-            na_strings=fileconfigs["transposed"],
-            ...)
+            na_strings=fileconfigs["na_strings"])
         if fileconfigs["transposed"]
         else process_untransposed(
                 fields,
-                na_strings=fileconfigs["transposed"],
-                headers,
-                ...))
+                fileconfigs,
+                headers=headers))
 
         if fileconfigs["transposed"]:
             headers = headers + (line_dets.header)
@@ -139,7 +137,7 @@ def file_statistics(lines: Iterator[str], fileconfigs: dict) -> FileStats:
         # TODO: do more processing
         continue # end of line processing
 
-    col_ids = identify_columns(fields)
+    col_ids = identify_columns(headers, fileconfigs)
     return FileStats(
         **stats,
         **({"dot_geno_fields": DotGenoFields(**dotgeno)}
@@ -147,7 +145,6 @@ def file_statistics(lines: Iterator[str], fileconfigs: dict) -> FileStats:
            else {}),
         samples_list=col_ids.samples,
         geno_symbols=tuple(genosymbols))
-            
 
 
 if __name__ == "__main__":