about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scripts/rqtl2/phenotypes_qc.py33
1 files changed, 25 insertions, 8 deletions
diff --git a/scripts/rqtl2/phenotypes_qc.py b/scripts/rqtl2/phenotypes_qc.py
index 7a52d09..f539cad 100644
--- a/scripts/rqtl2/phenotypes_qc.py
+++ b/scripts/rqtl2/phenotypes_qc.py
@@ -213,12 +213,21 @@ def qc_phenocovar_file(
                                             _line["description"],
                                             "The description is not provided!")),)
 
+            rconn.hset(file_fqkey(fqkey, "metadata", filepath),
+                       mapping={
+                           "status": "checking",
+                           "linecount": _lc+1,
+                           "total-errors": len(_errs)
+                       })
             return _errs, _lc+1
 
         _errors, _linecount = reduce(collect_errors, _csvfile, (_errors, 1))
-        rconn.hset(
-            f"{fqkey}:metadata",
-            mapping={"linecount": _linecount, "total-errors": len(_errors)})
+        rconn.hset(file_fqkey(fqkey, "metadata", filepath),
+                   mapping={
+                       "status": "completed",
+                       "linecount": _linecount,
+                       "total-errors": len(_errors)
+                   })
         return {filepath.name: {"errors": _errors, "linecount": _linecount}}
 
 
@@ -316,14 +325,22 @@ def qc_pheno_file(# pylint: disable=[too-many-arguments]
                     value)
                 _errs = _errs + ((save_error(_err),) if bool(_err) else tuple())
 
-            rconn.hset(f"{fqkey}:metadata", "linecount", _lc+1)
-            rconn.hset(f"{fqkey}:metadata", "total-errors", len(_errs))
+            rconn.hset(file_fqkey(fqkey, "metadata", filepath),
+                       mapping={
+                           "status": "checking",
+                           "linecount": _lc+1,
+                           "total-errors": len(_errs)
+                       })
             return _errs, _lc+1
 
-        logger.debug(f"[{filepath.name}] Collecting errors")
         _errors, _linecount = reduce(collect_errors, _csvfile, (_errors, 1))
-        logger.debug(f"[{filepath.name}] Finished collecting errors. Returning results …")
-        return {filepath.name: {"errors": _errors, "linecount": linecount}}
+        rconn.hset(file_fqkey(fqkey, "metadata", filepath),
+                   mapping={
+                       "status": "completed",
+                       "linecount": _linecount,
+                       "total-errors": len(_errors)
+                   })
+        return {filepath.name: {"errors": _errors, "linecount": _linecount}}
 
 
 def phenotype_names(filepath: Path,