aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-16 06:52:49 +0300
committerFrederick Muriuki Muriithi2024-01-16 06:52:49 +0300
commit0b8bd607645bf32e1713841e4c68dbc7ea60c0a2 (patch)
tree484fde6110ec739bafd4befa7a72308f9f5e34b5 /scripts
parentfc27d0447c189bfd9222c7e8ccc14074cfd6adce (diff)
downloadgn-uploader-0b8bd607645bf32e1713841e4c68dbc7ea60c0a2.tar.gz
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rqtl2/install_phenos.py5
1 files changed, 3 insertions, 2 deletions
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) "