Skip to content

Commit 0f797fd

Browse files
committed
Handle Annotation File links
1 parent 18c3d99 commit 0f797fd

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

idr_gallery/templates/idr_gallery/idr_study.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ <h2>{{ idr_id }}</h2>
5656
<p>{{ kvp.0 }}: {{ kvp.1 }}</p>
5757
{% endfor %}
5858

59+
<hr>
60+
61+
{% for annotation_file in annotation_files %}
62+
<p>Annotation File: <a href="{{ annotation_file.link }}">{{ annotation_file.name }}</a></p>
63+
{% endfor %}
64+
5965
<!-- {% if images %}
6066
<h3>Images</h3>
6167
<ul>

idr_gallery/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def parse_kvp_with_link(key, kvps):
4646
value = kvps.get(key)[0] if kvps.get(key) else None
4747
if value is None:
4848
return None
49+
return split_link(value)
50+
51+
52+
def split_link(value):
4953
return {
5054
"name": value.split("http", 1)[0].strip(),
5155
"link": "http" + value.split("http", 1)[1] if "http" in value else None

idr_gallery/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .data.background_images import IDR_IMAGES, TISSUE_IMAGES, CELL_IMAGES
2121
from .data.tabs import TABS
2222
from .version import VERSION
23-
from .utils import get_image_info, BIA_URL, parse_kvp_with_link, prefix_http
23+
from .utils import get_image_info, BIA_URL, parse_kvp_with_link, prefix_http, split_link
2424

2525
try:
2626
from omero_mapr import mapr_settings
@@ -165,7 +165,7 @@ def study_page(request, idrid, format="html", conn=None, **kwargs):
165165
containers = []
166166
for obj in objs:
167167
desc = obj.description
168-
for token in ["Screen Description", "Project Description"]:
168+
for token in ["Screen Description", "Project Description", "Experiment Description"]:
169169
if token in desc:
170170
desc = desc.split(token, 1)[1]
171171
containers.append({
@@ -202,7 +202,7 @@ def study_page(request, idrid, format="html", conn=None, **kwargs):
202202
bia_id = img_path.split(BIA_URL, 1)[-1].split("/", 1)[0]
203203

204204
KNOWN_KEYS = ["Publication Authors", "Study Title", "Publication Title", "Publication DOI", "Data DOI", "License",
205-
"PubMed ID", "PMC ID", "Release Date", "External URL"]
205+
"PubMed ID", "PMC ID", "Release Date", "External URL", "Annotation File"]
206206
other_kvps = []
207207
for k, v in kvps.items():
208208
if k in KNOWN_KEYS:
@@ -237,6 +237,7 @@ def study_page(request, idrid, format="html", conn=None, **kwargs):
237237
"pmc_id": parse_kvp_with_link("PMC ID", kvps),
238238
"release_date": kvps.get("Release Date")[0] if "Release Date" in kvps else None,
239239
"external_urls": [prefix_http(url) for url in kvps.get("External URL", [])],
240+
"annotation_files": [split_link(link) for link in kvps.get("Annotation File", [])],
240241
"other_kvps": other_kvps,
241242
"jsonld": json.dumps(jsonld, indent=2),
242243
}

0 commit comments

Comments
 (0)