aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-04-14 18:35:52 +0300
committerBonfaceKilz2023-04-17 15:25:20 +0300
commit7df45fb25bd760959120123d92fed1345f44e7d0 (patch)
tree3c75402c888a2ccb9ed8ba537f83bb064a0ff491 /wqflask
parentc21016add8fb6b66e4413f8cacba256d4dbf2404 (diff)
downloadgenenetwork2-7df45fb25bd760959120123d92fed1345f44e7d0.tar.gz
Add genewiki page
* wqflask/wqflask/templates/generif.html: New template. * wqflask/wqflask/views.py (display_diffs_users): New route. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/generif.html96
-rw-r--r--wqflask/wqflask/views.py16
2 files changed, 112 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/generif.html b/wqflask/wqflask/templates/generif.html
new file mode 100644
index 00000000..affcbbed
--- /dev/null
+++ b/wqflask/wqflask/templates/generif.html
@@ -0,0 +1,96 @@
+{% extends "base.html" %}
+
+{% block title %}
+GeneWiki Entry for {{ symbol }}
+{% endblock %}
+
+{% block css %}
+<style>
+
+ .badge {
+ vertical-align: top;
+ background-color: #336699;
+ }
+
+ .list-group {
+ counter-reset: gnentries;
+ }
+
+ summary::before {
+ counter-increment: gnentries;
+ content: counter(gnentries) "." " ";
+ }
+
+ summary:hover {
+ cursor: zoom-in;
+ }
+</style>
+
+{% endblock %}
+{% block content %}
+
+
+<div class="container">
+ <h1 class="page-header">GeneWiki For {{ symbol }}</h1>
+ <p class="well"><strong>GeneWiki</strong> enables you to enrich the annotation of genes and transcripts.</p>
+
+ <h3>
+ <strong>GeneNetwork</strong>
+ <span class="badge">
+ {{ entries.gn_entries|length if entries.gn_entries[0] else 0 }}
+ </span>:
+ </h3>
+ {% if entries.gn_entries[0] %}
+ <ul class="list-group">
+ {% for entry in entries.gn_entries %}
+ <li class="list-group-item">
+ <details>
+ <summary>{{ entry["entry"]["value"] }}</summary>
+ <dl class="dl-horizontal">
+ <dt>Author:</dt>
+ <dd>{{ entry["author"]["value"] }}</dd>
+
+ {% if entry.get("geneCategory") %}
+ <dt>Category:</dt>
+ <dd>{{ entry["geneCategory"]["value"]}}</dd>
+ {% endif %}
+
+ <dt>Add Time:</dt>
+ <dd>{{ entry["created"]["value"]}}</dd>
+ </dl>
+ </details>
+ </li>
+ {% endfor %}
+ </ul>
+
+ {% else %}
+
+ <p class="well"><u>There are no GeneNetwork entries for <b>{{ symbol }}.</b></u></p>
+
+ {% endif %}
+
+ <h3>
+ <strong>GeneRIF from NCBI</strong>
+ <span class="badge">
+ {{ entries.ncbi_entries|length if entries.ncbi_entries[0] else 0 }}
+ </span>:
+ </h3>
+ {% if entries.ncbi_entries[0] %}
+ <ol>
+ {% for entry in entries.ncbi_entries %}
+ <li>
+ {{ entry.entry.value }}
+ (<a href="{{ entry['generif']['value'] }}" target="_blank">{{ entry["speciesBinomialName"]["value"] }}</a>)
+ {% if entry.PubMedId.value != "" %}
+ {% set pmids = entry.PubMedId.value.split(",") %}
+ (PubMed: {% for id in pmids %} <a href="http://rdf.ncbi.nlm.nih.gov/pubmed/{{ id }}" target="_blank">{{ id }}</a>{% endfor %})
+ <sup><small><em>{{ entry.createdOn.value }}</em></small></sup>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ol>
+ {% else %}
+ <p class="well"><u>There are no NCBI entries for <b>{{ symbol }}.</b></u></p>
+ {% endif %}
+</div>
+{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 69576cc4..24426539 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1048,3 +1048,19 @@ def display_diffs_users():
files)
return render_template("display_files_user.html",
files=files)
+
+
+@app.route("/genewiki/<symbol>")
+def display_generif_page(symbol):
+ """Fetch GeneRIF metadata from GN3 and display it"""
+ entries = requests.get(
+ urljoin(
+ GN3_LOCAL_URL,
+ f"/api/metadata/genewiki/{symbol}"
+ )
+ ).json()
+ return render_template(
+ "generif.html",
+ symbol=symbol,
+ entries=entries
+ )