about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scripts/load_phenotypes_to_db.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py
index b78c648..980aa94 100644
--- a/scripts/load_phenotypes_to_db.py
+++ b/scripts/load_phenotypes_to_db.py
@@ -3,6 +3,7 @@ import json
 import logging
 import argparse
 from pathlib import Path
+from zipfile import ZipFile
 from typing import Any, Union
 
 from MySQLdb.cursors import Cursor, DictCursor
@@ -243,7 +244,12 @@ def load_data(conn, job):
         conn, int(_job_metadata.get("publicationid", "0"))) or {"Id": 0}
     # 2. Save all new phenotypes:
     #     -> return phenotype IDs
-    _control_data = rqtl.control_data(job["job-metadata"]["bundle-file"])
+    bundle = Path(_job_metadata["bundle_file"])
+    _control_data = rqtl2.control_data(bundle)
+    logger.info("Extracting the zipped bundle of files.")
+    _outdir = Path(bundle.parent, f"bundle_{bundle.stem}")
+    with ZipFile(str(bundle), "r") as zfile:
+        _files = rqtl2.extract(zfile, _outdir)
     logger.info("Saving basic phenotype data.")
 
     _phenos = save_phenotypes(cursor, _control_data)