aboutsummaryrefslogtreecommitdiff
path: root/uploader/phenotypes/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/phenotypes/views.py')
-rw-r--r--uploader/phenotypes/views.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py
index 97bcafe..834a450 100644
--- a/uploader/phenotypes/views.py
+++ b/uploader/phenotypes/views.py
@@ -374,10 +374,15 @@ def process_phenotypes_individual_files(error_uri):
bundlepath = Path(app.config["UPLOAD_FOLDER"],
f"{str(uuid.uuid4()).replace('-', '')}.zip")
with ZipFile(bundlepath,mode="w") as zfile:
- for rqtlkey, formkey in (("phenocovar", "phenotype-descriptions"),
- ("pheno", "phenotype-data"),
- ("phenose", "phenotype-se"),
- ("phenonum", "phenotype-n")):
+ for rqtlkey, formkey, _type in (
+ ("phenocovar", "phenotype-descriptions", "mandatory"),
+ ("pheno", "phenotype-data", "mandatory"),
+ ("phenose", "phenotype-se", "optional"),
+ ("phenonum", "phenotype-n", "optional")):
+ if _type == "optional" and not bool(form.get(formkey)):
+ # skip if an optional key does not exist.
+ continue
+
cdata[f"{rqtlkey}_transposed"] = (
(form.get(f"{formkey}-transposed") or "off") == "on")
@@ -1010,8 +1015,9 @@ def load_data_success(
gn2_uri = urlparse(app.config["GN2_SERVER_URL"])
job = gnlibs_jobs.job(jobsconn, job_id, fulldetails=True)
app.logger.debug("THE JOB: %s", job)
- _xref_ids = (str(item) for item
- in json.loads(job["metadata"].get("xref_ids", "[]")))
+ _xref_ids = tuple(
+ str(item) for item
+ in json.loads(job["metadata"].get("xref_ids", "[]")))
_publication = fetch_publication_by_id(
conn, int(job["metadata"].get("publication_id", "0")))
_search_terms = (item for item in