aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-05 15:42:16 +0300
committerFrederick Muriuki Muriithi2024-02-05 15:43:26 +0300
commit364dc6598e11151fd0b146814b2aaac272eec8d7 (patch)
tree629820fa7b0f49e7b53675632a4a12afbb890c1e /scripts
parent3f879d120f7628646f383a457206b15037cc57dc (diff)
downloadgn-uploader-364dc6598e11151fd0b146814b2aaac272eec8d7.tar.gz
Run QC on the 'geno' file in R/qtl2 bundle.
Diffstat (limited to 'scripts')
-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,