From 5568c4ee34d2539af7a6e880861dd90cca9fb78f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 2 Jul 2024 10:17:42 -0500 Subject: Ensure no duplicated values for the query. --- scripts/rqtl2/install_genotypes.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/rqtl2/install_genotypes.py b/scripts/rqtl2/install_genotypes.py index d0731a2..68ae365 100644 --- a/scripts/rqtl2/install_genotypes.py +++ b/scripts/rqtl2/install_genotypes.py @@ -40,11 +40,12 @@ def insert_markers(dbconn: mdb.Connection, "VALUES (%(speciesid)s, %(marker)s, %(marker)s, %(chr)s, %(pos)s) " "ON DUPLICATE KEY UPDATE SpeciesId=SpeciesId", tuple({ - "speciesid": speciesid, - "marker": marker, - "chr": mdata.get(marker, {}).get("chr"), - "pos": mdata.get(marker, {}).get("pos") - } for marker in markers)) + (speciesid, marker): { + "speciesid": speciesid, + "marker": marker, + "chr": mdata.get(marker, {}).get("chr"), + "pos": mdata.get(marker, {}).get("pos") + } for marker in markers}.items())) return cursor.rowcount def insert_individuals(dbconn: mdb.Connection, -- cgit v1.2.3