aboutsummaryrefslogtreecommitdiff
path: root/scripts/rqtl2
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/rqtl2')
-rw-r--r--scripts/rqtl2/install_genotypes.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/rqtl2/install_genotypes.py b/scripts/rqtl2/install_genotypes.py
index 3b9e987..5c3da85 100644
--- a/scripts/rqtl2/install_genotypes.py
+++ b/scripts/rqtl2/install_genotypes.py
@@ -57,8 +57,9 @@ def cross_reference_individuals(dbconn: mdb.Connection,
"""Cross reference any inserted individuals."""
with dbconn.cursor(cursorclass=DictCursor) as cursor:
paramstr = ", ".join(["%s"] * len(individuals))
- cursor.execute(f"SELECT Id FROM Strain WHERE Name IN ({paramstr})",
- individuals)
+ cursor.execute("SELECT Id FROM Strain "
+ f"WHERE SpeciesId=%s AND Name IN ({paramstr})",
+ (speciesid,) + individuals)
ids = ({"popid": populationid, "indid": row["Id"]}
for row in cursor.fetchall())
cursor.executemany(
@@ -71,7 +72,8 @@ def cross_reference_individuals(dbconn: mdb.Connection,
def insert_genotype_data(dbconn: mdb.Connection,
speciesid: int,
genotypes: tuple[dict, ...],
- individuals: tuple[str, ...]) -> tuple[int, tuple[int, ...]]:
+ individuals: tuple[str, ...]) -> tuple[
+ int, tuple[dict, ...]]:
"""Insert the genotype data values into the database."""
with dbconn.cursor(cursorclass=DictCursor) as cursor:
paramstr = ", ".join(["%s"] * len(individuals))
@@ -108,7 +110,7 @@ def insert_genotype_data(dbconn: mdb.Connection,
def cross_reference_genotypes(dbconn: mdb.Connection,
datasetid: int,
- dataids: tuple[int, ...]) -> int:
+ dataids: tuple[dict, ...]) -> int:
"""Cross-reference the data to the relevant dataset."""
with dbconn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
@@ -155,6 +157,7 @@ def install_genotypes(dbconn: mdb.Connection,
cross_reference_genotypes(dbconn, datasetid, dataids)
count = count + len(batch)
+ cdata = rqtl2.control_data(zfile)
if "gmap" in cdata:
logger.info("Loading genetic mapping info.")
# TODO: load gmap files
@@ -167,7 +170,8 @@ def install_genotypes(dbconn: mdb.Connection,
except rqtl2.InvalidFormat as exc:
logger.error(str(exc))
logger.info("There are no genotypes to load.")
- except Exception as _exc:
+ except Exception as _exc:# pylint: disable=[broad-except]
+ # Narrow this exception with time.
logger.error("Failing with exception: %s", traceback.format_exc())
return 3