aboutsummaryrefslogtreecommitdiff
path: root/scripts/qc_on_rqtl2_bundle.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-12 10:44:35 +0300
committerFrederick Muriuki Muriithi2024-02-12 18:17:41 +0300
commitabb55d7e03bf207ebf00b4c71f1bbdd8f58a0ad3 (patch)
tree65d97370d93b7ef19c271ef51f97d6d94b18a695 /scripts/qc_on_rqtl2_bundle.py
parent523bd6634539a2e646a7cd4215ad3ee7dbbeeb66 (diff)
downloadgn-uploader-abb55d7e03bf207ebf00b4c71f1bbdd8f58a0ad3.tar.gz
Check for errors in the 'phenose' file.
Diffstat (limited to 'scripts/qc_on_rqtl2_bundle.py')
-rw-r--r--scripts/qc_on_rqtl2_bundle.py59
1 files changed, 42 insertions, 17 deletions
diff --git a/scripts/qc_on_rqtl2_bundle.py b/scripts/qc_on_rqtl2_bundle.py
index aea1baa..c3e8b66 100644
--- a/scripts/qc_on_rqtl2_bundle.py
+++ b/scripts/qc_on_rqtl2_bundle.py
@@ -14,6 +14,7 @@ from qc_app import jobs
from qc_app.db_utils import database_connection
from qc_app.check_connections import check_db, check_redis
+from r_qtl import r_qtl2 as rqtl2
from r_qtl import r_qtl2_qc as rqc
from r_qtl import fileerrors as rqfe
@@ -59,31 +60,54 @@ def qc_missing_files(rconn: Redis,
def qc_geno_errors(rconn, fqjobid, zfile, logger) -> bool:
"""Check for errors in `geno` file(s)."""
logger.info("Checking for errors in the 'geno' file…")
- gerrs = tuple(rqc.geno_errors(zfile))
- add_to_errors(rconn, fqjobid, "errors-generic", tuple(
- err for err in gerrs if isinstance(err, rqfe.MissingFile)))
- add_to_errors(rconn, fqjobid, "errors-geno", tuple(
- err for err in gerrs if not isinstance(err, rqfe.MissingFile)))
- if len(gerrs) > 0:
- logger.error("The 'geno' file has errors.")
- return True
+ cdata = rqtl2.control_data(zfile)
+ if "geno" in cdata:
+ gerrs = tuple(rqc.geno_errors(zfile))
+ add_to_errors(rconn, fqjobid, "errors-generic", tuple(
+ err for err in gerrs if isinstance(err, rqfe.MissingFile)))
+ add_to_errors(rconn, fqjobid, "errors-geno", tuple(
+ err for err in gerrs if not isinstance(err, rqfe.MissingFile)))
+ if len(gerrs) > 0:
+ logger.error("The 'geno' file has errors.")
+ return True
+
logger.info("No errors found in the 'geno' file.")
return False
def qc_pheno_errors(rconn, fqjobid, zfile, logger) -> bool:
"""Check for errors in `pheno` file(s)."""
- logger.info("Checking for errors in the 'pheno' file …")
- perrs = tuple(rqc.pheno_errors(zfile))
- add_to_errors(rconn, fqjobid, "errors-generic", tuple(
- err for err in perrs if isinstance(err, rqfe.MissingFile)))
- add_to_errors(rconn, fqjobid, "errors-pheno", tuple(
- err for err in perrs if not isinstance(err, rqfe.MissingFile)))
- if len(perrs) > 0:
- logger.error("The 'pheno' file has errors.")
- return True
+ logger.info("Checking for errors in the 'pheno' file…")
+ cdata = rqtl2.control_data(zfile)
+ if "pheno" in cdata:
+ perrs = tuple(rqc.pheno_errors(zfile))
+ add_to_errors(rconn, fqjobid, "errors-generic", tuple(
+ err for err in perrs if isinstance(err, rqfe.MissingFile)))
+ add_to_errors(rconn, fqjobid, "errors-pheno", tuple(
+ err for err in perrs if not isinstance(err, rqfe.MissingFile)))
+ if len(perrs) > 0:
+ logger.error("The 'pheno' file has errors.")
+ return True
+
logger.info("No errors found in the 'pheno' file.")
return False
+def qc_phenose_errors(rconn, fqjobid, zfile, logger) -> bool:
+ """Check for errors in `phenose` file(s)."""
+ logger.info("Checking for errors in the 'phenose' file…")
+ cdata = rqtl2.control_data(zfile)
+ if "phenose" in cdata:
+ perrs = tuple(rqc.phenose_errors(zfile))
+ add_to_errors(rconn, fqjobid, "errors-generic", tuple(
+ err for err in perrs if isinstance(err, rqfe.MissingFile)))
+ add_to_errors(rconn, fqjobid, "errors-phenose", tuple(
+ err for err in perrs if not isinstance(err, rqfe.MissingFile)))
+ if len(perrs) > 0:
+ logger.error("The 'phenose' file has errors.")
+ return True
+
+ logger.info("No errors found in the 'phenose' file.")
+ return False
+
def qc_phenocovar_errors(_rconn, _fqjobid, _zfile, _logger) -> bool:
"""Check for errors in `phenocovar` file(s)."""
return False
@@ -104,6 +128,7 @@ def run_qc(rconn: Redis,
1 if any((
qc_geno_errors(rconn, fqjobid, zfile, logger),
qc_pheno_errors(rconn, fqjobid, zfile, logger),
+ qc_phenose_errors(rconn, fqjobid, zfile, logger),
qc_phenocovar_errors(rconn, fqjobid, zfile, logger)))
else 0)