about summary refs log tree commit diff
path: root/scripts/rqtl2
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-10-02 10:09:31 -0500
committerFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-10-02 10:09:31 -0500
commit9652c118028ea30c423c3c08deb031c5fe2df76e (patch)
tree44a3d79d0c7711edc4d32f15af19cea69925b65a /scripts/rqtl2
parent49260fefb471e3c005a1c900b111a6df1cd53fdb (diff)
downloadgn-uploader-9652c118028ea30c423c3c08deb031c5fe2df76e.tar.gz
Update calls to CSV processing functions.
- Update the imports
- Pass in function rather than comment-char value
Diffstat (limited to 'scripts/rqtl2')
-rw-r--r--scripts/rqtl2/phenotypes_qc.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/rqtl2/phenotypes_qc.py b/scripts/rqtl2/phenotypes_qc.py
index e65bbcc..943cd68 100644
--- a/scripts/rqtl2/phenotypes_qc.py
+++ b/scripts/rqtl2/phenotypes_qc.py
@@ -26,6 +26,7 @@ from functional_tools import chain
 
 from quality_control.checks import decimal_places_pattern
 
+from uploader.csvprocessing import read_csv_file
 from uploader.files import sha256_digest_over_file
 from uploader.samples.models import samples_by_species_and_population
 
@@ -185,7 +186,8 @@ def qc_phenocovar_file(
             f"{fqkey}:logs") as _logger,
           Redis.from_url(redisuri, decode_responses=True) as rconn):
         print("Running QC on file: ", filepath.name)
-        _csvfile = rqtl2.read_csv_file(filepath, separator, comment_char)
+        _csvfile = read_csv_file(
+            filepath, separator, lambda line: line.startswith(comment_char))
         _headings = tuple(heading.lower() for heading in next(_csvfile))
         _errors: tuple[InvalidValue, ...] = tuple()
         save_error = partial(
@@ -296,7 +298,8 @@ def qc_pheno_file(# pylint: disable=[too-many-locals, too-many-arguments, too-ma
         print("Running QC on file: ", filepath.name)
         save_error = partial(
             push_error, rconn, file_fqkey(fqkey, "errors", filepath))
-        _csvfile = rqtl2.read_csv_file(filepath, separator, comment_char)
+        _csvfile = read_csv_file(
+            filepath, separator, lambda line: line.startswith(comment_char))
         _headings: tuple[str, ...] = tuple(
             # select lowercase for comparison purposes
             heading.lower() for heading in next(_csvfile))
@@ -362,7 +365,10 @@ def phenotype_names(filepath: Path,
                     comment_char: str) -> tuple[str, ...]:
     """Read phenotype names from `phenocovar` file."""
     return reduce(lambda tpl, line: tpl + (line[0],),#type: ignore[arg-type, return-value]
-                  rqtl2.read_csv_file(filepath, separator, comment_char),
+                  read_csv_file(
+                      filepath,
+                      separator,
+                      lambda line: line.startswith(comment_char)),
                   tuple())[1:]
 
 def fullyqualifiedkey(