diff options
author | Frederick Muriuki Muriithi | 2025-05-19 14:35:31 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-05-19 14:35:31 -0500 |
commit | 1f30748f3a87a810cdb242d5c2927689f0b6877f (patch) | |
tree | dcedf226c43636f646f243041d220ee9d0801e9f | |
parent | 5bd5f3cf1ae30467df5e4a040fec2acb20be6cee (diff) | |
download | gn-uploader-1f30748f3a87a810cdb242d5c2927689f0b6877f.tar.gz |
Retrieve publication first.
-rw-r--r-- | scripts/load_phenotypes_to_db.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py index 7e1112e..2be8096 100644 --- a/scripts/load_phenotypes_to_db.py +++ b/scripts/load_phenotypes_to_db.py @@ -225,7 +225,10 @@ def load_data(conn, job): # Steps # 0. Read data from the files: can be multiple files per type # - # 1. Save all new phenotypes: + # 1. Just retrive the publication: Don't create publications for now. + _publication = fetch_publication_by_id( + 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"]) logger.info("Saving basic phenotype data.") @@ -234,13 +237,11 @@ def load_data(conn, job): dataidmap = { row["phenotype_id"]: { "phenotype_id": row["phenotype_id"], - "data_id": dataid + "data_id": dataid, + "publication_id": _publication["Id"], } for dataid, row in enumerate(_phenos, start=__fetch_next_dataid__(conn)) } - # 2. Just retrive the publication: Don't create publications for now. - publication = fetch_publication_by_id( - conn, int(_job_metadata.get("publicationid", "0"))) or {"Id": 0} # 3. a. Fetch the strain names and IDS: create name->ID map samples = { row["Name"]: row |