From 90ed50db7385b11994dc72874aae94cc647fc855 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 15 Feb 2024 11:02:22 +0300 Subject: Filter out NULL values --- scripts/rqtl2/install_genotypes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/rqtl2/install_genotypes.py b/scripts/rqtl2/install_genotypes.py index 7f3f65a..709fe0f 100644 --- a/scripts/rqtl2/install_genotypes.py +++ b/scripts/rqtl2/install_genotypes.py @@ -99,7 +99,7 @@ def insert_genotype_data(dbconn: mdb.Connection, markerids = {row["Name"]: row["Id"] for row in cursor.fetchall()} cursor.execute("SELECT MAX(Id) AS lastid FROM GenoData") lastid = cursor.fetchone()["lastid"] - data = tuple( + data = tuple(item for item in ( {**row, "gid": gid} for gid, row in enumerate( ({ @@ -109,6 +109,7 @@ def insert_genotype_data(dbconn: mdb.Connection, } for innerrow in genotypes for marker in (key for key in innerrow.keys() if key != "id")), start=lastid+1)) + if item["value"] is not None) cursor.executemany( "INSERT INTO GenoData(Id, StrainId, value) " "VALUES(%(gid)s, %(indid)s, %(value)s)", -- cgit v1.2.3