aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-06-02 13:44:13 -0500
committerFrederick Muriuki Muriithi2025-06-02 13:44:13 -0500
commit75c0183b88067fa3a6ca74fa383aefee0938564a (patch)
treeb5bb2a7a9eee14c800893e28454c78f3c01936b3
parent68e5c8a8206ce1ba16c281b89b9a57c2a88a6615 (diff)
downloadgn-uploader-75c0183b88067fa3a6ca74fa383aefee0938564a.tar.gz
Revert "Convert N/A values to NoneType objects."
This reverts commit 6870c08d484f482cc2f2501d28b474636dd0810d. The "read_csv_file" should return the data in the CSV file, as is, before processing the N/A values.
-rw-r--r--r_qtl/r_qtl2.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index ec70c5c..b1eae90 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -6,7 +6,7 @@ import json
from pathlib import Path
from functools import reduce, partial
from zipfile import ZipFile, is_zipfile
-from typing import Union, Iterator, Iterable, Callable, Optional, Sequence
+from typing import Union, Iterator, Iterable, Callable, Optional
import yaml
@@ -572,21 +572,14 @@ def read_text_file(filepath: Union[str, Path]) -> Iterator[str]:
yield line
-def read_csv_file(
- filepath: Union[str, Path],
- separator: str = ",",
- comment_char: str = "#",
- na_strings: Sequence[str] = ["NA"]
-) -> Iterator[tuple[str, ...]]:
+def read_csv_file(filepath: Union[str, Path],
+ separator: str = ",",
+ comment_char: str = "#") -> Iterator[tuple[str, ...]]:
"""Read a file as a csv file."""
- def __none_if_na__(val):
- return None if val in na_strings else val
-
for line in read_text_file(filepath):
if line.startswith(comment_char):
continue
- yield tuple(__none_if_na__(field.strip())
- for field in line.split(separator))
+ yield tuple(field.strip() for field in line.split(separator))
def read_csv_file_headers(