aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-15 11:02:22 +0300
committerFrederick Muriuki Muriithi2024-02-15 11:02:22 +0300
commit90ed50db7385b11994dc72874aae94cc647fc855 (patch)
treeb79c2c605d99914d96cac60182aa40e27de1cc5c
parent22a3076313b5ea3229320ba2ea30b77b3eb72c7e (diff)
downloadgn-uploader-90ed50db7385b11994dc72874aae94cc647fc855.tar.gz
Filter out NULL values
-rw-r--r--scripts/rqtl2/install_genotypes.py3
1 files changed, 2 insertions, 1 deletions
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)",