about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scripts/rqtl2/install_genotypes.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/rqtl2/install_genotypes.py b/scripts/rqtl2/install_genotypes.py
index 1eb3b75..966728f 100644
--- a/scripts/rqtl2/install_genotypes.py
+++ b/scripts/rqtl2/install_genotypes.py
@@ -162,7 +162,7 @@ def cross_reference_genotypes(
             "The select query was\n\t%s\n\nwith the parameters\n\t%s",
             selectquery,
             (speciesid,) + markers)
-        cursor.execute(query, insertparams)
+        cursor.execute(selectquery, insertparams)
         markersdict = {row["Id"]: row["Name"] for row in cursor.fetchall()}
         insertquery = (
             "INSERT INTO GenoXRef(GenoFreezeId, GenoId, DataId, cM) "
@@ -183,11 +183,12 @@ def cross_reference_genotypes(
 
 def install_genotypes(#pylint: disable=[too-many-arguments, too-many-locals]
         dbconn: mdb.Connection,
-                      speciesid: int,
-                      populationid: int,
-                      datasetid: int,
-                      rqtl2bundle: Path,
-                      logger: Logger = getLogger()) -> int:
+        speciesid: int,
+        populationid: int,
+        datasetid: int,
+        rqtl2bundle: Path,
+        logger: Logger = getLogger(__name__)
+) -> int:
     """Load any existing genotypes into the database."""
     count = 0
     with ZipFile(str(rqtl2bundle.absolute()), "r") as zfile:
@@ -216,11 +217,11 @@ def install_genotypes(#pylint: disable=[too-many-arguments, too-many-locals]
                      else None),
                     logger)
                 individuals = tuple(row["id"] for row in batch)
-                insert_individuals(dbconn, speciesid, individuals)
+                insert_individuals(dbconn, speciesid, individuals, logger)
                 cross_reference_individuals(
-                    dbconn, speciesid, populationid, individuals)
+                    dbconn, speciesid, populationid, individuals, logger)
                 _num_rows, dataids = insert_genotype_data(
-                    dbconn, speciesid, batch, individuals)
+                    dbconn, speciesid, batch, individuals, logger)
                 cross_reference_genotypes(
                     dbconn,
                     speciesid,