From 06a760328a8ae9cb6d89a5ecc64c4e3281cb9bf1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 8 Aug 2024 15:00:27 -0500 Subject: Fix bugs and pass in logger to functions. --- scripts/rqtl2/install_genotypes.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'scripts') 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, -- cgit v1.2.3