aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-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)