From 0b8bd607645bf32e1713841e4c68dbc7ea60c0a2 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 16 Jan 2024 06:52:49 +0300 Subject: Filter out items with values of `None`. The ProbeSetData table does not allow `NULL` for the `value` column for good reason - if there is no value, just don't have a record for that particular sample. --- scripts/rqtl2/install_phenos.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/rqtl2/install_phenos.py b/scripts/rqtl2/install_phenos.py index 4fdf428..5c25866 100644 --- a/scripts/rqtl2/install_phenos.py +++ b/scripts/rqtl2/install_phenos.py @@ -54,12 +54,13 @@ def insert_probeset_data(dbconn: mdb.Connection, data = tuple( {**row, "psdid": lastid + idx} for idx, row in enumerate( - ({ + (item for item in ({ "sampleid": sampleids[innerrow["id"]], "value": innerrow[pheno], "pheno": pheno } for innerrow in phenos for pheno in - (key for key in innerrow.keys() if key != "id")), + (key for key in innerrow.keys() if key != "id")) + if item["value"] is not None), start=1)) cursor.executemany( "INSERT INTO ProbeSetData(Id, StrainId, value) " -- cgit v1.2.3