aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-08-13 15:02:15 -0500
committerFrederick Muriuki Muriithi2024-08-13 15:02:15 -0500
commit5e3076c8e5a9945dec4256809af70b7644b35887 (patch)
treefb2c1877cf329b0ff136a756263806f54cde8249
parentbe09ad3e0746d2e9df03a65941f869fbc4f4ca47 (diff)
downloadgn-uploader-5e3076c8e5a9945dec4256809af70b7644b35887.tar.gz
Bug: cross reference with NULL cM when "gmap" file is absent
The "gmap" file might not exist in some bundles. In those instances, cross-reference the data without including the genotypes' physical positions (cM).
-rw-r--r--scripts/rqtl2/install_genotypes.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/scripts/rqtl2/install_genotypes.py b/scripts/rqtl2/install_genotypes.py
index 966728f..08fc0ba 100644
--- a/scripts/rqtl2/install_genotypes.py
+++ b/scripts/rqtl2/install_genotypes.py
@@ -154,16 +154,19 @@ def cross_reference_genotypes(
(tuple(), tuple(), {}))
with dbconn.cursor(cursorclass=DictCursor) as cursor:
- paramstr = ", ".join(["%s"] * len(markers))
- insertparams = (speciesid,) + markers
- selectquery = ("SELECT Id, Name FROM Geno "
- f"WHERE SpeciesId=%s AND Name IN ({paramstr})")
- _logger.debug(
- "The select query was\n\t%s\n\nwith the parameters\n\t%s",
- selectquery,
- (speciesid,) + markers)
- cursor.execute(selectquery, insertparams)
- markersdict = {row["Id"]: row["Name"] for row in cursor.fetchall()}
+ markersdict = {}
+ if len(markers) > 0:
+ paramstr = ", ".join(["%s"] * len(markers))
+ insertparams = (speciesid,) + markers
+ selectquery = ("SELECT Id, Name FROM Geno "
+ f"WHERE SpeciesId=%s AND Name IN ({paramstr})")
+ _logger.debug(
+ "The select query was\n\t%s\n\nwith the parameters\n\t%s",
+ selectquery,
+ (speciesid,) + markers)
+ cursor.execute(selectquery, insertparams)
+ markersdict = {row["Id"]: row["Name"] for row in cursor.fetchall()}
+
insertquery = (
"INSERT INTO GenoXRef(GenoFreezeId, GenoId, DataId, cM) "
"VALUES(%(datasetid)s, %(markerid)s, %(dataid)s, %(pos)s) "