From 364dc6598e11151fd0b146814b2aaac272eec8d7 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 5 Feb 2024 15:42:16 +0300 Subject: Run QC on the 'geno' file in R/qtl2 bundle. --- scripts/process_rqtl2_bundle.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'scripts') 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, -- cgit v1.2.3