aboutsummaryrefslogtreecommitdiff
path: root/scripts/process_rqtl2_bundle.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/process_rqtl2_bundle.py')
-rw-r--r--scripts/process_rqtl2_bundle.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/process_rqtl2_bundle.py b/scripts/process_rqtl2_bundle.py
index 6ba746a..4da3936 100644
--- a/scripts/process_rqtl2_bundle.py
+++ b/scripts/process_rqtl2_bundle.py
@@ -11,6 +11,10 @@ from logging import Logger, getLogger, StreamHandler
import MySQLdb as mdb
from redis import Redis
+from functional_tools import take
+
+import r_qtl.errors as rqe
+import r_qtl.r_qtl2 as rqtl2
import r_qtl.r_qtl2_qc as rqc
from qc_app import jobs
@@ -60,6 +64,19 @@ def qc_r_qtl2_bundle(bundlefilepath, logger):
logger.info(
"Bundle successfully validated. All listed files are present.")
+ cdata = rqtl2.control_data(zfile)
+ if "geno" in cdata:
+ gerr = False
+ logger.info("Validating 'geno' file.")
+ for error in take(rqc.geno_errors(zfile), 10):
+ gerr = True
+ logger.error("%s: [Line %s, Field %s]",
+ error[2], error[0], error[1])
+ if gerr:
+ logger.error("... more")
+ raise rqe.InvalidFormat("'geno' file content contains errors.")
+ logger.info("'geno' file validation was successful.")
+
def process_bundle(dbconn: mdb.Connection,
rconn: Redis,
rprefix: str,