Skip to content

Commit

Permalink
avoid empty datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed May 21, 2020
1 parent b076f13 commit 9572abb
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions wort/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,20 @@ def view(public_db=None, dataset_id=None):
if isinstance(dataset, bool):
# This was generated in the compute view, fix it to be a dict
dataset = {}
dataset["name"] = dataset_id.upper()
dataset["db"] = public_db.upper()
dataset["link"] = f"/v1/view/{public_db}/{dataset_id}"
if public_db == "sra":
dataset[
"metadata"
] = f"https://trace.ncbi.nlm.nih.gov/Traces/sra/?run={dataset_id.upper()}"
elif public_db == "img":
dataset[
"metadata"
] = f"https://img.jgi.doe.gov/cgi-bin/m/main.cgi?section=TaxonDetail&page=taxonDetail&taxon_oid={dataset_id}"
current_app.cache.set(f"wort-{public_db}/sigs/{dataset_id}.sig", dataset)

dataset["name"] = dataset_id.upper()
dataset["db"] = public_db.upper()
dataset["link"] = f"/v1/view/{public_db}/{dataset_id}"
if public_db == "sra":
dataset[
"metadata"
] = f"https://trace.ncbi.nlm.nih.gov/Traces/sra/?run={dataset_id.upper()}"
elif public_db == "img":
dataset[
"metadata"
] = f"https://img.jgi.doe.gov/cgi-bin/m/main.cgi?section=TaxonDetail&page=taxonDetail&taxon_oid={dataset_id}"

current_app.cache.set(f"wort-{public_db}/sigs/{dataset_id}.sig", dataset)
else:
# TODO: is it really missing, or cache wasn't set up properly?
# this is especially true for IMG, since there is no point in code
Expand Down

0 comments on commit 9572abb

Please sign in to comment.