aboutsummaryrefslogtreecommitdiff
path: root/scripts/rqtl2
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-08-08 15:00:27 -0500
committerFrederick Muriuki Muriithi2024-08-08 15:29:44 -0500
commit06a760328a8ae9cb6d89a5ecc64c4e3281cb9bf1 (patch)
tree4fbf345a2578ce151104018e40ba379b2439690c /scripts/rqtl2
parent494f138387216757b61b8c2d3b4f98ecc197d18c (diff)
downloadgn-uploader-06a760328a8ae9cb6d89a5ecc64c4e3281cb9bf1.tar.gz
Fix bugs and pass in logger to functions.
Diffstat (limited to 'scripts/rqtl2')
-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,